py_mac.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #coding=utf-8
  2. #!/usr/bin/python
  3. import sys
  4. sys.path.append('..')
  5. from base.spider import Spider
  6. import requests
  7. import json
  8. class Spider(Spider):
  9. def getDependence(self):
  10. return ['py_ali']
  11. def getName(self):
  12. return "py_mac"
  13. def init(self,extend):
  14. self.ali = extend[0]
  15. print("============py_mac============")
  16. pass
  17. def isVideoFormat(self,url):
  18. pass
  19. def manualVideoCheck(self):
  20. pass
  21. def homeContent(self,filter):
  22. result = {}
  23. return result
  24. def homeVideoContent(self):
  25. result = {}
  26. return result
  27. def categoryContent(self,tid,pg,filter,extend):
  28. result = {}
  29. return result
  30. header = {
  31. "User-Agent": "Mozilla/5.0 (Linux; Android 12; V2049A Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36",
  32. "Referer": "http://ali.546326.xyz"
  33. }
  34. def detailContent(self,array):
  35. tid = array[0]
  36. #print(tid)
  37. #print(self.getName())
  38. url="http://ali.546326.xyz/api.php/provide/vod/?ac=detail&ids={0}".format(tid)
  39. vods=requests.get(url=url, headers=self.header, verify=False).json()["list"][0]
  40. playurl = vods['vod_play_url']
  41. playArray = playurl.split("#")
  42. newArray =[]
  43. for vod in playArray:
  44. if vod:
  45. vds = vod.split("$")
  46. playurl = vds[1].replace(" ","")
  47. pattern = '(https://www.aliyundrive.com/s/[^\"]+)'
  48. url = self.regStr(playurl, pattern)
  49. if len(url) > 0:
  50. newArray.append(playurl)
  51. if len(newArray) == 0:
  52. return ""
  53. #print(newArray)
  54. return self.ali.detailContent(newArray)
  55. def searchContent(self,key,quick):
  56. url = "http://ali.546326.xyz/api.php/provide/vod/?wd={0}".format(key)
  57. rsp = requests.get(url=url, headers=self.header, verify=False)
  58. vodList = json.loads(self.cleanText(rsp.text))["list"]
  59. videos = []
  60. for vod in vodList:
  61. videos.append({
  62. "vod_id": vod["vod_id"],
  63. "vod_name": vod["vod_name"],
  64. "vod_pic": "https://img0.baidu.com/it/u=603086994,1727626977&fm=253&fmt=auto?w=500&h=667",#字段不存在
  65. "vod_remarks": vod["vod_remarks"]
  66. })
  67. result = {
  68. 'list':videos
  69. }
  70. return result
  71. def playerContent(self,flag,id,vipFlags):
  72. return self.ali.playerContent(flag,id,vipFlags)
  73. config = {
  74. "player": {},
  75. "filter": {}
  76. }
  77. header = {}
  78. def localProxy(self,param):
  79. return [200, "video/MP2T", action, ""]