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 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1",
  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. print(newArray)
  45. return self.ali.detailContent(newArray)
  46. def searchContent(self,key,quick):
  47. map = {
  48. '7':'文件夹',
  49. '1':'视频'
  50. }
  51. ja = []
  52. for tKey in map.keys():
  53. url = "https://zhaoziyuan.la/so?filename={0}&t={1}".format(key,tKey)
  54. rsp = self.fetch(url,headers=self.header)
  55. root = self.html(self.cleanText(rsp.text))
  56. aList = root.xpath("//li[@class='clear']//a")
  57. for a in aList:
  58. # title = a.xpath('./h3/text()')[0] + a.xpath('./p/text()')[0]
  59. title = self.xpText(a,'./h3/text()') + self.xpText(a,'./p/text()')
  60. pic = 'https://img0.baidu.com/it/u=603086994,1727626977&fm=253&fmt=auto?w=500&h=667'
  61. jo = {
  62. 'vod_id': self.xpText(a,'@href'),
  63. 'vod_name': '[{0}]{1}'.format(key,title),
  64. 'vod_pic': pic
  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, ""]