py_yixi.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #coding=utf-8
  2. #!/usr/bin/python
  3. import sys
  4. sys.path.append('..')
  5. from base.spider import Spider
  6. import json
  7. import time
  8. import base64
  9. class Spider(Spider):
  10. def getName(self):
  11. return "一席"
  12. def init(self,extend=""):
  13. print("============{0}============".format(extend))
  14. pass
  15. def isVideoFormat(self,url):
  16. pass
  17. def manualVideoCheck(self):
  18. pass
  19. def homeContent(self,filter):
  20. result = {}
  21. url = 'https://yixi.tv/api/site/category/?_=1'
  22. jo = self.fetch(url,headers=self.header).json()
  23. category = jo['data']['items']
  24. classes = []
  25. classes.append({
  26. 'type_name':'全部',
  27. 'type_id':''
  28. })
  29. for cat in category:
  30. classes.append({
  31. 'type_name':cat['title'],
  32. 'type_id':cat['id']
  33. })
  34. result['class'] = classes
  35. if(filter):
  36. result['filters'] = self.config['filter']
  37. return result
  38. def homeVideoContent(self):
  39. # url = 'https://yixi.tv/api/site/album/?page=1&page_size=4&_=1'
  40. url = 'https://yixi.tv/api/site/album/22/detail/?page=1&page_size=24&_=1'
  41. jo = self.fetch(url,headers=self.header).json()
  42. videos = []
  43. vodList = jo['data']['items']
  44. for vod in vodList:
  45. videos.append({
  46. "vod_id":vod['id'],
  47. "vod_name":vod['title'],
  48. "vod_pic":vod['cover'],
  49. "vod_remarks":vod['time']
  50. })
  51. result = {
  52. 'list':videos
  53. }
  54. return result
  55. def categoryContent(self,tid,pg,filter,extend):
  56. result = {}
  57. url = 'https://yixi.tv/api/site/speech/?page={1}&page_size=12&category_id={0}&order_by=0&_=1'.format(tid,pg)
  58. jo = self.fetch(url,headers=self.header).json()
  59. videos = []
  60. vodList = jo['data']['items']
  61. for vod in vodList:
  62. videos.append({
  63. "vod_id":vod['id'],
  64. "vod_name":vod['title'],
  65. "vod_pic":vod['cover'],
  66. "vod_remarks":vod['time']
  67. })
  68. result['list'] = videos
  69. result['page'] = pg
  70. result['pagecount'] = 9999
  71. result['limit'] = 90
  72. result['total'] = 999999
  73. return result
  74. def detailContent(self,array):
  75. tid = array[0]
  76. url = "https://yixi.tv/api/site/speech/{0}/detail/?_=1".format(tid)
  77. jo = self.fetch(url,headers=self.header).json()
  78. vod = {
  79. "vod_id":jo['data']['speech']['id'],
  80. "vod_name":jo['data']['speech']['title'],
  81. "vod_pic":jo['data']['speech']['cover'],
  82. "type_name":jo['data']['speech']['first_category'],
  83. "vod_year":"",
  84. "vod_area":"",
  85. "vod_remarks":jo['data']['speech']['date'],
  86. "vod_actor":"",
  87. "vod_director":"",
  88. "vod_content":jo['data']['speech']['titlelanguage']
  89. }
  90. vod['vod_play_from'] = '一席'
  91. pList = []
  92. for vUrl in jo['data']['speech']['video_url']:
  93. pList.append(vUrl['type_name']+"$"+vUrl['video_url'])
  94. vod['vod_play_url'] = '#'.join(pList)
  95. result = {
  96. 'list':[
  97. vod
  98. ]
  99. }
  100. return result
  101. def searchContent(self,key,quick):
  102. result = {
  103. 'list':[]
  104. }
  105. return result
  106. def playerContent(self,flag,id,vipFlags):
  107. result = {}
  108. result["parse"] = 0
  109. result["playUrl"] = ''
  110. result["url"] = id
  111. result["header"] = ''
  112. return result
  113. config = {
  114. "player": {},
  115. "filter": {}
  116. }
  117. header = {
  118. "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"
  119. }
  120. def localProxy(self,param):
  121. return [200, "video/MP2T", action, ""]