xinshijue_open.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. let key = 'xinshijue';
  3. let HOST = 'https://www.hdmyy.com';
  4. let siteKey = '';
  5. let siteType = 0;
  6. const UA = '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';
  7. async function request(reqUrl, timeout = 20000) {
  8. let res = await req(reqUrl, {
  9. method: 'get',
  10. headers: {
  11. 'User-Agent': UA,
  12. 'Referer': HOST
  13. },
  14. timeout: timeout,
  15. });
  16. return res.content;
  17. }
  18. // cfg = {skey: siteKey, ext: extend}
  19. async function init(cfg) {
  20. siteKey = cfg.skey;
  21. siteType = cfg.stype;
  22. }
  23. async function home(filter) {
  24. let classes = [{'type_id':1,'type_name':'电影'},{'type_id':2,'type_name':'电视剧'},{'type_id':3,'type_name':'综艺'},{'type_id':4,'type_name':'动漫'},{'type_id':63,'type_name':'纪录片'}];
  25. let filterObj = {
  26. '1':[{'key':'class','name':'剧情','init':'','value':[{'n':'全部','v':''},{'n':'喜剧','v':'喜剧'},{'n':'爱情','v':'爱情'},{'n':'恐怖','v':'恐怖'},{'n':'动作','v':'动作'},{'n':'科幻','v':'科幻'},{'n':'剧情','v':'剧情'},{'n':'战争','v':'战争'},{'n':'警匪','v':'警匪'},{'n':'犯罪','v':'犯罪'},{'n':'动画','v':'动画'},{'n':'奇幻','v':'奇幻'},{'n':'武侠','v':'武侠'},{'n':'冒险','v':'冒险'},{'n':'枪战','v':'枪战'},{'n':'恐怖','v':'恐怖'},{'n':'悬疑','v':'悬疑'},{'n':'惊悚','v':'惊悚'},{'n':'经典','v':'经典'},{'n':'青春','v':'青春'},{'n':'文艺','v':'文艺'},{'n':'微电影','v':'微电影'},{'n':'古装','v':'古装'},{'n':'历史','v':'历史'},{'n':'运动','v':'运动'},{'n':'农村','v':'农村'},{'n':'儿童','v':'儿童'},{'n':'网络电影','v':'网络电影'}]},{'key':'area','name':'地区','init':'','value':[{'n':'全部','v':''},{'n':'中国大陆','v':'中国大陆'},{'n':'中国香港','v':'中国香港'},{'n':'中国台湾','v':'中国台湾'},{'n':'美国','v':'美国'},{'n':'法国','v':'法国'},{'n':'英国','v':'英国'},{'n':'日本','v':'日本'},{'n':'韩国','v':'韩国'},{'n':'德国','v':'德国'},{'n':'泰国','v':'泰国'},{'n':'印度','v':'印度'},{'n':'意大利','v':'意大利'},{'n':'西班牙','v':'西班牙'},{'n':'加拿大','v':'加拿大'},{'n':'其他','v':'其他'}]},{'key':'year','name':'年份','init':'','value':[{'n':'全部','v':''},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'}]},{'key':'by','name':'排序','value':[{'n':'时间','v':'time'},{'n':'人气','v':'hits'},{'n':'评分','v':'score'}]}],
  27. '2':[{'key':'class','name':'剧情','init':'','value':[{'n':'全部','v':''},{'n':'爱情','v':'爱情'},{'n':'古装','v':'古装'},{'n':'悬疑','v':'悬疑'},{'n':'都市','v':'都市'},{'n':'喜剧','v':'喜剧'},{'n':'战争','v':'战争'},{'n':'剧情','v':'剧情'},{'n':'青春','v':'青春'},{'n':'历史','v':'历史'},{'n':'网剧','v':'网剧'},{'n':'奇幻','v':'奇幻'},{'n':'冒险','v':'冒险'},{'n':'励志','v':'励志'},{'n':'犯罪','v':'犯罪'},{'n':'商战','v':'商战'},{'n':'恐怖','v':'恐怖'},{'n':'穿越','v':'穿越'},{'n':'农村','v':'农村'},{'n':'人物','v':'人物'},{'n':'商业','v':'商业'},{'n':'生活','v':'生活'},{'n':'短剧','v':'短剧'},{'n':'其他','v':'其他'}]},{'key':'area','name':'地区','init':'','value':[{'n':'全部','v':''},{'n':'中国大陆','v':'中国大陆'},{'n':'中国香港','v':'中国香港'},{'n':'中国台湾','v':'中国台湾'},{'n':'韩国','v':'韩国'},{'n':'香港','v':'香港'},{'n':'台湾','v':'台湾'},{'n':'日本','v':'日本'},{'n':'美国','v':'美国'},{'n':'泰国','v':'泰国'},{'n':'英国','v':'英国'},{'n':'新加坡','v':'新加坡'},{'n':'其他','v':'其他'}]},{'key':'year','name':'年份','init':'','value':[{'n':'全部','v':''},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'}]},{'key':'by','name':'排序','value':[{'n':'时间','v':'time'},{'n':'人气','v':'hits'},{'n':'评分','v':'score'}]}],
  28. '3':[{'key':'class','name':'剧情','init':'','value':[{'n':'全部','v':''},{'n':'音乐','v':'音乐'},{'n':'情感','v':'情感'},{'n':'生活','v':'生活'},{'n':'职场','v':'职场'},{'n':'真人秀','v':'真人秀'},{'n':'搞笑','v':'搞笑'},{'n':'公益','v':'公益'},{'n':'艺术','v':'艺术'},{'n':'访谈','v':'访谈'},{'n':'益智','v':'益智'},{'n':'体育','v':'体育'},{'n':'少儿','v':'少儿'},{'n':'时尚','v':'时尚'},{'n':'人物','v':'人物'},{'n':'其他','v':'其他'}]},{'key':'area','name':'地区','init':'','value':[{'n':'全部','v':''},{'n':'中国大陆','v':'中国大陆'},{'n':'港台','v':'港台'},{'n':'韩国','v':'韩国'},{'n':'欧美','v':'欧美'},{'n':'其他','v':'其他'}]},{'key':'year','name':'年份','init':'','value':[{'n':'全部','v':''},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'}]},{'key':'by','name':'排序','value':[{'n':'时间','v':'time'},{'n':'人气','v':'hits'},{'n':'评分','v':'score'}]}],
  29. '4':[{'key':'class','name':'剧情','init':'','value':[{'n':'全部','v':''},{'n':'冒险','v':'冒险'},{'n':'战斗','v':'战斗'},{'n':'搞笑','v':'搞笑'},{'n':'经典','v':'经典'},{'n':'科幻','v':'科幻'},{'n':'玄幻','v':'玄幻'},{'n':'魔幻','v':'魔幻'},{'n':'武侠','v':'武侠'},{'n':'恋爱','v':'恋爱'},{'n':'推理','v':'推理'},{'n':'日常','v':'日常'},{'n':'校园','v':'校园'},{'n':'悬疑','v':'悬疑'},{'n':'真人','v':'真人'},{'n':'历史','v':'历史'},{'n':'竞技','v':'竞技'},{'n':'其他','v':'其他'}]},{'key':'area','name':'地区','init':'','value':[{'n':'全部','v':''},{'n':'中国大陆','v':'中国大陆'},{'n':'日本','v':'日本'},{'n':'韩国','v':'韩国'},{'n':'欧美','v':'欧美'},{'n':'其他','v':'其他'}]},{'key':'year','name':'年份','init':'','value':[{'n':'全部','v':''},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'}]},{'key':'by','name':'排序','value':[{'n':'时间','v':'time'},{'n':'人气','v':'hits'},{'n':'评分','v':'score'}]}],
  30. '63':[{'key':'by','name':'排序','value':[{'n':'时间','v':'time'},{'n':'人气','v':'hits'},{'n':'评分','v':'score'}]}],
  31. };
  32. return JSON.stringify({
  33. class: classes,
  34. filters: filterObj,
  35. });
  36. }
  37. async function homeVod() {}
  38. async function category(tid, pg, filter, extend) {
  39. if (pg <= 0) pg = 1;
  40. let page = '';
  41. if (pg > 1) {
  42. page = pg;
  43. }
  44. const link = HOST + '/vodshow/' + tid + '-' + (extend.area || '') + '-' + (extend.by || '') + '-' + (extend.class || '') + '-' + (extend.lang || '') + '-' + (extend.letter || '') + '---' + page + '---' + (extend.year || '') + '.html';
  45. const html = await request(link);
  46. const $ = load(html);
  47. const items = $('.module-list .module-item');
  48. const videos = _.map(items, (item) => {
  49. const $item = $(item);
  50. const link = $item.find('.module-item-content a:first').attr('href');
  51. const title = $item.find('.video-name').text().trim();
  52. const img = $item.find('.module-item-pic img:first').attr('data-src');
  53. const remarks = $item.find('.module-item-text').text().trim();
  54. return {
  55. vod_id: link.replace(/.*?\/video\/(.*).html/g, '$1'),
  56. vod_name: title,
  57. vod_pic: img,
  58. vod_remarks: remarks || '',
  59. };
  60. });
  61. const hasMore = $('#page a.page-next:contains(下一页)').length > 0;
  62. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  63. const limit = 40;
  64. return JSON.stringify({
  65. page: parseInt(pg),
  66. pagecount: pgCount,
  67. limit: limit,
  68. total: limit * pgCount,
  69. list: videos,
  70. });
  71. }
  72. async function detail(id) {
  73. const html = await request(HOST + '/video/' + id + '.html');
  74. const $ = load(html);
  75. const vod = {
  76. vod_id: id,
  77. vod_name: $('h1.page-title').text().trim(),
  78. vod_type: $('.video-info-aux a.tag-link:first').text().trim(),
  79. vod_area: $('.video-info-aux a.tag-link:eq(2)').text().trim(),
  80. vod_year: $('.video-info-aux a.tag-link:eq(1)').text().trim(),
  81. vod_director: $('.video-info-main .video-info-items:contains(导演:)').text().substring(3).trim().replace(/(^\/|\/$)/g, '').trim(),
  82. vod_actor: $('.video-info-main .video-info-items:contains(主演:)').text().substring(3).trim().replace(/(^\/|\/$)/g, '').trim(),
  83. vod_pic: $('.video-cover img:first').attr('data-src'),
  84. vod_remarks : $('.video-info-main .video-info-items:contains(备注:)').text().substring(3) || '',
  85. vod_content: $('.video-info-main .video-info-items:contains(剧情:)').text().substring(3).trim().replace(/收起$/g, ''),
  86. };
  87. const playMap = {};
  88. const tabs = $('.module-player-tab .module-tab-item');
  89. const playlists = $('.module-player-list > .module-blocklist');
  90. _.each(tabs, (tab, i) => {
  91. const $tab = $(tab);
  92. const from = $tab.find('span:first').text().trim();
  93. if (from.includes('夸克')) return;
  94. let list = playlists[i];
  95. list = $(list).find('a');
  96. _.each(list, (it) => {
  97. const $it = $(it);
  98. const title = $it.find('span:first').text().trim();
  99. const playUrl = $it.attr('href');
  100. if (!playMap.hasOwnProperty(from)) {
  101. playMap[from] = [];
  102. }
  103. playMap[from].push(title + '$' + playUrl);
  104. });
  105. });
  106. vod.vod_play_from = _.keys(playMap).join('$$$');
  107. const urls = _.values(playMap);
  108. const vod_play_url = _.map(urls, (urlist) => {
  109. return urlist.join('#');
  110. });
  111. vod.vod_play_url = vod_play_url.join('$$$');
  112. return JSON.stringify({
  113. list: [vod],
  114. });
  115. }
  116. async function play(flag, id, flags) {
  117. const link = HOST + id;
  118. const html = await request(link);
  119. let $ = load(html);
  120. let json = $('script:contains(player_aaaa)').text().replace('var player_aaaa=','');
  121. let js = JSON.parse(json);
  122. let playUrl = js.url;
  123. if (js.encrypt == 1) {
  124. playUrl = unescape(playUrl);
  125. } else if (js.encrypt == 2) {
  126. playUrl = unescape(base64Decode(playUrl));
  127. }
  128. let playHtml = await request('https://jx3.xn--1lq90i13mxk5bolhm8k.xn--fiqs8s/player/ec.php?code=ak&if=1&url=' + playUrl);
  129. json = playHtml.match(/let ConFig = {([\w\W]*)},box/)[1];
  130. const jsConfig = JSON.parse('{' + json.trim() + '}');
  131. playUrl = decryptUrl(jsConfig);
  132. return JSON.stringify({
  133. parse: 0,
  134. url: playUrl,
  135. header: {
  136. 'User-Agent': UA,
  137. }
  138. });
  139. }
  140. function decryptUrl(jsConfig) {
  141. const key = Crypto.enc.Utf8.parse('2890' + jsConfig.config.uid + 'tB959C');
  142. const iv = Crypto.enc.Utf8.parse('2F131BE91247866E');
  143. const mode = Crypto.mode.CBC;
  144. const padding = Crypto.pad.Pkcs7;
  145. const decrypted = Crypto.AES.decrypt(jsConfig.url, key, {
  146. 'iv': iv,
  147. 'mode': mode,
  148. 'padding': padding
  149. });
  150. const decryptedUrl = Crypto.enc.Utf8.stringify(decrypted);
  151. return decryptedUrl;
  152. }
  153. function base64Decode(text) {
  154. return Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(text));
  155. }
  156. async function search(wd, quick, pg) {
  157. let data = JSON.parse(await request(HOST + '/index.php/ajax/suggest?mid=1&limit=50&wd=' + wd)).list;
  158. let videos = [];
  159. for (const vod of data) {
  160. videos.push({
  161. vod_id: vod.id,
  162. vod_name: vod.name,
  163. vod_pic: vod.pic,
  164. vod_remarks: '',
  165. });
  166. }
  167. return JSON.stringify({
  168. list: videos,
  169. });
  170. }
  171. export function __jsEvalReturn() {
  172. return {
  173. init: init,
  174. home: home,
  175. homeVod: homeVod,
  176. category: category,
  177. detail: detail,
  178. play: play,
  179. search: search,
  180. };
  181. }