MCPcopy Create free account
hub / github.com/UndCover/PyramidStore / playerContent

Method playerContent

plugin/py_bilivd.py:188–222  ·  view source on GitHub ↗
(self, flag, id, vipFlags)

Source from the content-addressed store, hash-verified

186 return result
187
188 def playerContent(self, flag, id, vipFlags):
189 result = {}
190
191 ids = id.split("_")
192 url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid={1}&qn=116'.format(ids[0], ids[1])
193 if len(self.cookies) <= 0:
194 self.getCookie()
195 rsp = self.fetch(url, cookies=self.cookies)
196 jRoot = json.loads(rsp.text)
197 jo = jRoot['data']
198 ja = jo['durl']
199
200 maxSize = -1
201 position = -1
202 for i in range(len(ja)):
203 tmpJo = ja[i]
204 if maxSize < int(tmpJo['size']):
205 maxSize = int(tmpJo['size'])
206 position = i
207
208 url = ''
209 if len(ja) > 0:
210 if position == -1:
211 position = 0
212 url = ja[position]['url']
213
214 result["parse"] = 0
215 result["playUrl"] = ''
216 result["url"] = url
217 result["header"] = {
218 "Referer": "https://www.bilibili.com",
219 "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
220 }
221 result["contentType"] = 'video/x-flv'
222 return result
223
224 config = {
225 "player": {},

Callers

nothing calls this directly

Calls 2

getCookieMethod · 0.95
fetchMethod · 0.95

Tested by

no test coverage detected