py_yunso.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. import base64
  9. class Spider(Spider):
  10. def getDependence(self):
  11. return ['py_ali']
  12. def getName(self):
  13. return "py_yunso"
  14. def init(self,extend):
  15. self.ali = extend[0]
  16. print("============py_yunso============")
  17. pass
  18. def isVideoFormat(self,url):
  19. pass
  20. def manualVideoCheck(self):
  21. pass
  22. def homeContent(self,filter):
  23. result = {}
  24. return result
  25. def homeVideoContent(self):
  26. result = {}
  27. return result
  28. def categoryContent(self,tid,pg,filter,extend):
  29. result = {}
  30. return result
  31. header = {
  32. "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",
  33. "origin": "https://www.upyunso.com/"
  34. }
  35. def detailContent(self,array):
  36. id = array[0]
  37. ysurl = 'https://api.upyunso.com/{0}'.format(id.replace('.html', ''))
  38. header = {
  39. "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",
  40. "referer": "https://www.upyunso.com/{0}".format(id),
  41. "origin": "https://www.upyunso.com/"
  42. }
  43. urlrsp = requests.get(url=ysurl, headers=header).text.encode('ISO-8859-1').decode('UTF-8')
  44. url = ["{0}".format(json.loads(base64.b64decode(urlrsp))['result']['res_url'])]
  45. print(url)
  46. return self.ali.detailContent(url)
  47. def searchContent(self,key,quick):
  48. url = "https://api.upyunso.com/search?keyword={0}&page=1&s_type=2".format(key)
  49. rsp = requests.get(url=url, headers=self.header)
  50. vodList = json.loads(base64.b64decode(rsp.text))['result']['items']
  51. videos = []
  52. for vod in vodList:
  53. conList = vod['content']
  54. for con in conList:
  55. if 'download.html?url' in con['size']:
  56. vid = con['size']
  57. videos.append({
  58. "vod_id": vid,
  59. "vod_name": con['title'],
  60. "vod_pic": "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000",
  61. "vod_remarks": vod['insert_time']
  62. })
  63. result = {
  64. 'list':videos
  65. }
  66. return result
  67. def playerContent(self,flag,id,vipFlags):
  68. return self.ali.playerContent(flag,id,vipFlags)
  69. config = {
  70. "player": {},
  71. "filter": {}
  72. }
  73. header = {}
  74. def localProxy(self,param):
  75. return [200, "video/MP2T", action, ""]