py_zhaozy.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #coding=utf-8
  2. #!/usr/bin/python
  3. import sys
  4. sys.path.append('..')
  5. from base.spider import Spider
  6. class Spider(Spider):
  7. def getDependence(self):
  8. return ['py_ali']
  9. def getName(self):
  10. return "py_zhaozy"
  11. def init(self,extend):
  12. self.ali = extend[0]
  13. print("============py_zhaozy============")
  14. pass
  15. def isVideoFormat(self,url):
  16. pass
  17. def manualVideoCheck(self):
  18. pass
  19. def homeContent(self,filter):
  20. result = {}
  21. return result
  22. def homeVideoContent(self):
  23. result = {}
  24. return result
  25. def categoryContent(self,tid,pg,filter,extend):
  26. result = {}
  27. return result
  28. header = {
  29. "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36",
  30. "Referer": "https://zhaoziyuan.la/"
  31. }
  32. def detailContent(self,array):
  33. tid = array[0]
  34. print(self.getName())
  35. pattern = '(https://www.aliyundrive.com/s/[^\"]+)'
  36. url = self.regStr(tid,pattern)
  37. if len(url) > 0:
  38. return self.ali.detailContent(array)
  39. rsp = self.fetch('https://zhaoziyuan.la/'+tid)
  40. url = self.regStr(rsp.text,pattern)
  41. if len(url) == 0:
  42. return ""
  43. newArray = [url]
  44. return self.ali.detailContent(newArray)
  45. def searchContent(self,key,quick):
  46. map = {
  47. '7':'文件夹',
  48. '1':'视频'
  49. }
  50. ja = []
  51. for tKey in map.keys():
  52. url = "https://zhaoziyuan.la/so?filename={0}&t={1}".format(key,tKey)
  53. rsp = self.fetch(url,headers=self.header)
  54. root = self.html(self.cleanText(rsp.text))
  55. aList = root.xpath("//li[@class='clear']/div/div[@class='news_text']/a")
  56. for a in aList:
  57. title = self.xpText(a,'./h3/text()')
  58. pic = 'https://inews.gtimg.com/newsapp_bt/0/13263837859/1000'
  59. remark = self.xpText(a,'./p/text()').split('|')[1].strip()
  60. jo = {
  61. 'vod_id': self.xpText(a,'@href'),
  62. 'vod_name': title,
  63. 'vod_pic': pic,
  64. "vod_remarks": remark
  65. }
  66. ja.append(jo)
  67. result = {
  68. 'list':ja
  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, ""]