py_jieyingshi.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # -*- coding: utf-8 -*-
  2. # @Author : Doubebly
  3. # @Time : 2025/1/21 23:07
  4. import hashlib
  5. import re
  6. import sys
  7. import time
  8. import requests
  9. sys.path.append('..')
  10. from base.spider import Spider
  11. class Spider(Spider):
  12. def getName(self):
  13. return "JieYingShi"
  14. def init(self, extend):
  15. self.home_url = 'https://www.hkybqufgh.com'
  16. self.error_url = 'https://json.doube.eu.org/error/4gtv/index.m3u8'
  17. self.headers = {
  18. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
  19. }
  20. def getDependence(self):
  21. return []
  22. def isVideoFormat(self, url):
  23. pass
  24. def manualVideoCheck(self):
  25. pass
  26. def homeContent(self, filter):
  27. return {'class': [
  28. {
  29. 'type_id': '1',
  30. 'type_name': '电影'
  31. },
  32. {
  33. 'type_id': '2',
  34. 'type_name': '电视剧'
  35. },
  36. {
  37. 'type_id': '4',
  38. 'type_name': '动漫'
  39. },
  40. {
  41. 'type_id': '3',
  42. 'type_name': '综艺'
  43. }
  44. ]}
  45. def homeVideoContent(self):
  46. a = self.get_data(self.home_url)
  47. return {'list': a, 'parse': 0, 'jx': 0}
  48. def categoryContent(self, cid, page, filter, ext):
  49. url = self.home_url + f'/vod/show/id/{cid}/page/{page}'
  50. data = self.get_data(url)
  51. return {'list': data, 'parse': 0, 'jx': 0}
  52. def detailContent(self, did):
  53. ids = did[0]
  54. data = self.get_detail_data(ids)
  55. return {"list": data, 'parse': 0, 'jx': 0}
  56. def searchContent(self, key, quick, page='1'):
  57. if int(page) > 1:
  58. return {'list': [], 'parse': 0, 'jx': 0}
  59. url = self.home_url + f'/vod/search/{key}'
  60. data = self.get_data(url)
  61. return {'list': data, 'parse': 0, 'jx': 0}
  62. def playerContent(self, flag, pid, vipFlags):
  63. url = self.get_play_data(pid)
  64. return {"url": url, "header": self.headers, "parse": 1, "jx": 0}
  65. def localProxy(self, params):
  66. pass
  67. def destroy(self):
  68. return '正在Destroy'
  69. def get_data(self, url):
  70. data = []
  71. try:
  72. res = requests.get(url, headers=self.headers)
  73. if res.status_code != 200:
  74. return data
  75. vod_id_s = re.findall(r'\\"vodId\\":(.*?),', res.text)
  76. vod_name_s = re.findall(r'\\"vodName\\":\\"(.*?)\\"', res.text)
  77. vod_pic_s = re.findall(r'\\"vodPic\\":\\"(.*?)\\"', res.text)
  78. vod_remarks_s = re.findall(r'\\"vodRemarks\\":\\"(.*?)\\"', res.text)
  79. for i in range(len(vod_id_s)):
  80. data.append(
  81. {
  82. 'vod_id': vod_id_s[i],
  83. 'vod_name': vod_name_s[i],
  84. 'vod_pic': vod_pic_s[i],
  85. 'vod_remarks': vod_remarks_s[i],
  86. }
  87. )
  88. except requests.RequestException as e:
  89. print(e)
  90. return data
  91. def get_detail_data(self, ids):
  92. url = self.home_url + f'/api/mw-movie/anonymous/video/detail?id={ids}'
  93. t = str(int(time.time() * 1000))
  94. headers = self.get_headers(t, f'id={ids}&key=cb808529bae6b6be45ecfab29a4889bc&t={t}')
  95. try:
  96. res = requests.get(url, headers=headers)
  97. if res.status_code != 200:
  98. return []
  99. i = res.json()['data']
  100. urls = []
  101. for ii in res.json()['data']['episodeList']:
  102. name = ii['name']
  103. url = ii['nid']
  104. urls.append(f'{name}${ids}-{url}')
  105. data = {
  106. 'type_name': i['vodClass'],
  107. 'vod_id': i['vodId'],
  108. 'vod_name': i['vodName'],
  109. 'vod_remarks': i['vodRemarks'],
  110. 'vod_year': i['vodYear'],
  111. 'vod_area': i['vodArea'],
  112. 'vod_actor': i['vodActor'],
  113. 'vod_director': i['vodDirector'],
  114. 'vod_content': i['vodContent'],
  115. 'vod_play_from': '默认',
  116. 'vod_play_url': '#'.join(urls),
  117. }
  118. return [data]
  119. except requests.RequestException as e:
  120. print(e)
  121. return []
  122. def get_play_data(self, play):
  123. info = play.split('-')
  124. _id = info[0]
  125. _pid = info[1]
  126. url = self.home_url + f'/api/mw-movie/anonymous/v1/video/episode/url?id={_id}&nid={_pid}'
  127. t = str(int(time.time() * 1000))
  128. headers = self.get_headers(t, f'id={_id}&nid={_pid}&key=cb808529bae6b6be45ecfab29a4889bc&t={t}')
  129. try:
  130. res = requests.get(url, headers=headers)
  131. if res.status_code != 200:
  132. return self.error_url
  133. return res.json()['data']['playUrl']
  134. except requests.RequestException as e:
  135. print(e)
  136. return self.error_url
  137. @staticmethod
  138. def get_headers(t, e):
  139. sign = hashlib.sha1(hashlib.md5(e.encode()).hexdigest().encode()).hexdigest()
  140. headers = {
  141. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
  142. 'Accept': 'application/json, text/plain, */*',
  143. 'sign': sign,
  144. 'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
  145. 't': t,
  146. 'referer': 'https://www.hkybqufgh.com/',
  147. }
  148. return headers
  149. if __name__ == '__main__':
  150. pass