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

Method playerContent

plugin/py_bilibili.py:133–166  ·  view source on GitHub ↗
(self,flag,id,vipFlags)

Source from the content-addressed store, hash-verified

131 }
132 return result
133 def playerContent(self,flag,id,vipFlags):
134 # https://www.555dianying.cc/vodplay/static/js/playerconfig.js
135 result = {}
136
137 ids = id.split("_")
138 url = 'https://api.bilibili.com:443/x/player/playurl?avid={0}&cid=%20%20{1}&qn=112'.format(ids[0],ids[1])
139 rsp = self.fetch(url)
140 jRoot = json.loads(rsp.text)
141 jo = jRoot['data']
142 ja = jo['durl']
143
144 maxSize = -1
145 position = -1
146 for i in range(len(ja)):
147 tmpJo = ja[i]
148 if maxSize < int(tmpJo['size']):
149 maxSize = int(tmpJo['size'])
150 position = i
151
152 url = ''
153 if len(ja) > 0:
154 if position == -1:
155 position = 0
156 url = ja[position]['url']
157
158 result["parse"] = 0
159 result["playUrl"] = ''
160 result["url"] = url
161 result["header"] = {
162 "Referer":"https://www.bilibili.com",
163 "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"
164 }
165 result["contentType"] = 'video/x-flv'
166 return result
167
168 config = {
169 "player": {},

Callers

nothing calls this directly

Calls 1

fetchMethod · 0.95

Tested by

no test coverage detected