| 203 | } |
| 204 | return result |
| 205 | def playerContent(self,flag,id,vipFlags): |
| 206 | url = 'https://xmaomi.net/{0}.html'.format(id) |
| 207 | tmpRsp = self.fetch(url) |
| 208 | suffix = self.regStr(tmpRsp.text,"window.location.href =\"(\\S+)\"") |
| 209 | url = "https://xmaomi.net"+suffix |
| 210 | rsp = self.fetch(url,cookies=tmpRsp.cookies) |
| 211 | root = self.html(rsp.text) |
| 212 | print(rsp.text[0]) |
| 213 | print(root) |
| 214 | scripts = root.xpath("//script/text()") |
| 215 | jo = {} |
| 216 | for script in scripts: |
| 217 | if(script.startswith("var player_")): |
| 218 | target = script[script.index('{'):] |
| 219 | jo = json.loads(target) |
| 220 | break; |
| 221 | parseUrl = "" |
| 222 | print(jo) |
| 223 | htmlUrl = 'https://play.fositv.com/?url={0}&tm={1}&key={2}&next=&title='.format(jo['url'],jo['tm'],jo['key']) |
| 224 | htmlRsp = self.fetch(htmlUrl) |
| 225 | htmlRoot = self.html(htmlRsp.text) |
| 226 | configScripts = htmlRoot.xpath("//script/text()") |
| 227 | configJo = {} |
| 228 | for script in configScripts: |
| 229 | if(script.strip().startswith("var config")): |
| 230 | target = script[script.index('{'):(script.index('}')+1)] |
| 231 | configJo = json.loads(target) |
| 232 | break; |
| 233 | param = { |
| 234 | 'url': configJo['url'], |
| 235 | 'time': configJo['time'], |
| 236 | 'key': configJo['key'] |
| 237 | } |
| 238 | postRsp = self.post('https://play.fositv.com/API.php',param) |
| 239 | resultJo = json.loads(postRsp.text) |
| 240 | result = { |
| 241 | 'parse':0, |
| 242 | 'playUrl':'', |
| 243 | 'url':resultJo['url'], |
| 244 | 'header':{ |
| 245 | 'User-Agent':resultJo['ua'] |
| 246 | } |
| 247 | } |
| 248 | return result |
| 249 | |
| 250 | cookie = {} |
| 251 | config = { |