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

Method playerContent

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

Source from the content-addressed store, hash-verified

164 return result
165
166 def playerContent(self,flag,id,vipFlags):
167 result = {}
168 ids = id.split("_")
169 header = {
170 "Referer": "https://www.bilibili.com",
171 "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"
172 }
173 url = 'https://api.bilibili.com/pgc/player/web/playurl?qn=116&ep_id={0}&cid={1}'.format(ids[0],ids[1])
174 if len(self.cookies) <= 0:
175 self.getCookie()
176 rsp = self.fetch(url,cookies=self.cookies,headers=header)
177 jRoot = json.loads(rsp.text)
178 if jRoot['message'] != 'success':
179 print("需要大会员权限才能观看")
180 return {}
181 jo = jRoot['result']
182 ja = jo['durl']
183 maxSize = -1
184 position = -1
185 for i in range(len(ja)):
186 tmpJo = ja[i]
187 if maxSize < int(tmpJo['size']):
188 maxSize = int(tmpJo['size'])
189 position = i
190
191 url = ''
192 if len(ja) > 0:
193 if position == -1:
194 position = 0
195 url = ja[position]['url']
196
197 result["parse"] = 0
198 result["playUrl"] = ''
199 result["url"] = url
200 result["header"] = {
201 "Referer":"https://www.bilibili.com",
202 "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"
203 }
204 result["contentType"] = 'video/x-flv'
205 return result
206
207 config = {
208 "player": {},

Callers

nothing calls this directly

Calls 2

getCookieMethod · 0.95
fetchMethod · 0.95

Tested by

no test coverage detected