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

Method playerContent

plugin/py_zxzj.py:206–240  ·  view source on GitHub ↗
(self,flag,id,vipFlags)

Source from the content-addressed store, hash-verified

204 "Accept-Encoding":"gzip, deflate"
205 }
206 def playerContent(self,flag,id,vipFlags):
207 result = {}
208 url = 'https://zxzj.vip/video/{0}.html'.format(id)
209 rsp = self.fetch(url)
210 root = self.html(rsp.text)
211 scripts = root.xpath("//script/text()")
212 jo = {}
213 for script in scripts:
214 if(script.startswith("var player_")):
215 target = script[script.index('{'):]
216 jo = json.loads(target)
217 break;
218 parseUrl = ''
219 # src="(\S+url=)
220 # playerConfig = self.config['player']
221 # if jo['from'] in self.config['player']:
222 # playerConfig = self.config['player'][jo['from']]
223 # parseUrl = playerConfig['pu'] + jo['url']
224 scriptUrl = 'https://zxzj.vip/static/player/{0}.js'.format(jo['from'])
225 scriptRsp = self.fetch(scriptUrl)
226 parseUrl = self.regStr(scriptRsp.text,'src="(\\S+url=)')
227 if len(parseUrl) > 0:
228 parseRsp = self.fetch(parseUrl+jo['url'])
229 realUrl = self.regStr(parseRsp.text,"(?<=urls\\s=\\s').*?(?=')",0)
230 if len(realUrl) > 0 :
231 result["parse"] = 0
232 result["playUrl"] = ""
233 result["url"] = realUrl
234 result["header"] = json.dumps(self.header)
235 else:
236 result["parse"] = 1
237 result["playUrl"] = ""
238 result["url"] = jo['url']
239 result["header"] = json.dumps(self.header)
240 return result
241 def isVideoFormat(self,url):
242 pass
243 def manualVideoCheck(self):

Callers

nothing calls this directly

Calls 3

fetchMethod · 0.95
htmlMethod · 0.95
regStrMethod · 0.95

Tested by

no test coverage detected