hdmoli_open.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. let key = 'moli';
  3. let HOST = 'https://hdmoli.pro';
  4. let host = '';
  5. let siteKey = '';
  6. let siteType = 0;
  7. const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
  8. async function request(reqUrl, extHeader) {
  9. let headers = {
  10. 'User-Agent': MOBILE_UA,
  11. 'Referer': HOST,
  12. };
  13. const res = await req(reqUrl, {
  14. method: 'get',
  15. headers: headers,
  16. });
  17. return res.content;
  18. }
  19. // cfg = {skey: siteKey, ext: extend}
  20. async function init(cfg) {
  21. siteKey = cfg.skey;
  22. siteType = cfg.stype;
  23. }
  24. async function home(filter) {
  25. let classes = [{
  26. type_id: 1,
  27. type_name: '电影',
  28. },{
  29. type_id: 2,
  30. type_name: '剧集',
  31. },{
  32. type_id: 41,
  33. type_name: '动画',
  34. }];
  35. const filterObj = {
  36. 1: [{ key: 'type', name: '类型', value: [{ n: '动作', v: '5' }, { v: '6', n: '爱情' }, { v: '7', n: '科幻' }, { v: '8', n: '恐怖' },{ n: '战争', v: '9' }, { v: '10', n: '喜剧' }, { v: '11', n: '纪录片' }, { v: '12', n: '剧情' }, { v: '30', n: '犯罪' }, { v: '32', n: '动画' }] },{ key: 'area', name: '地区', value: [{ n: '美国', v: '美国' }, { v: '韩国', n: '韩国' }, { v: '英国', n: '英国' }, { v: '日本', n: '日本' }, { v: '泰国', n: '泰国' }, { v: '中国', n: '中国' }, { v: '其他', n: '其他' }] },{ key: 'year', name: '年份', value: [{ n: '2024', v: '2024' }, { v: '2023', n: '2023' }, { v: '2022', n: '2022' }, { v: '2021', n: '2021' }, { v: '2020', n: '2020' }, { v: '2019', n: '2019' },{ n: '2018', v: '2018' }, { v: '2017', n: '2017' }, { v: '2016', n: '2016' }, { v: '2015', n: '2015' }, { v: '2014', n: '2014' }, { v: '2013', n: '2013' }, { v: 'more', n: 'more' }] }],
  37. 2: [{ key: 'type', name: '类型', value: [{ n: '美剧', v: '15' }, { v: '16', n: '韩剧' }, { v: '13', n: '日剧' }, { v: '34', n: '英剧' },{ n: '中国', v: '14' }, { v: '29', n: '泰剧' }, { v: '39', n: '综艺' }, { v: '38', n: '其他' }] },{ key: 'area', name: '地区', value: [{ n: '美国', v: '美国' }, { v: '韩国', n: '韩国' }, { v: '英国', n: '英国' }, { v: '日本', n: '日本' }, { v: '泰国', n: '泰国' }, { v: '中国', n: '中国' }, { v: '其他', n: '其他' }] },{ key: 'year', name: '年份', value: [{ n: '2024', v: '2024' }, { v: '2023', n: '2023' }, { v: '2022', n: '2022' }, { v: '2021', n: '2021' }, { v: '2020', n: '2020' }, { v: '2019', n: '2019' },{ n: '2018', v: '2018' }, { v: '2017', n: '2017' }, { v: '2016', n: '2016' }, { v: '2015', n: '2015' }, { v: '2014', n: '2014' }, { v: '2013', n: '2013' }, { v: 'more', n: 'more' }] }],
  38. 41: [{ key: 'type', name: '地区', value: [{ n: '日本', v: '42' }, { v: '43', n: '其他' }] },{ key: 'year', name: '年份', value: [{ n: '2024', v: '2024' }, { v: '2023', n: '2023' }, { v: '2022', n: '2022' }, { v: '2021', n: '2021' }, { v: '2020', n: '2020' }, { v: '2019', n: '2019' },{ n: '2018', v: '2018' }, { v: '2017', n: '2017' }, { v: '2016', n: '2016' }, { v: '2015', n: '2015' }, { v: '2014', n: '2014' }, { v: '2013', n: '2013' }, { v: 'more', n: 'more' }] }],
  39. };
  40. return JSON.stringify({
  41. class: classes,
  42. filters: filterObj,
  43. });
  44. }
  45. async function homeVod() {
  46. const $ = load(await request(HOST));
  47. const videos = _.map($('div.myui-vodlist__box > a'), item => {
  48. return {
  49. vod_id: $(item).attr('href'),
  50. vod_name: $(item).attr('title'),
  51. vod_pic: $(item).attr('data-original'),
  52. vod_remarks: $($(item).find('span.pic-text')).text().trim(),
  53. vod_year: $($(item).find('span.pic-tag')).text().trim(),
  54. }
  55. });
  56. return JSON.stringify({
  57. list: videos,
  58. });
  59. }
  60. async function category(tid, pg, filter, extend) {
  61. if (pg <= 0 || typeof (pg) == 'undefined') pg = 1;
  62. const type = extend['type'] ? extend['type'] : tid;
  63. const area = extend['area'] ? extend['area'] : '';
  64. const year = extend['year'] ? extend['year'] : '';
  65. const url = HOST + `/search.php?page=${pg}&searchtype=5&tid=${type}&area=${area}&year=${year}`;
  66. const $ = load(await request(url));
  67. const videos = _.map($('div.myui-vodlist__box > a'), item => {
  68. return {
  69. vod_id: $(item).attr('href'),
  70. vod_name: $(item).attr('title'),
  71. vod_pic: $(item).attr('data-original'),
  72. vod_remarks: $($(item).find('span.pic-text')).text().trim(),
  73. vod_year: $($(item).find('span.pic-tag')).text().trim(),
  74. }
  75. });
  76. return JSON.stringify({
  77. list: videos,
  78. page: pg,
  79. limit: 20,
  80. total: videos.length
  81. });
  82. }
  83. async function detail(id) {
  84. const url = HOST + id;
  85. const $ = load(await request(url));
  86. let playFroms = [];
  87. let playUrls = [];
  88. const playList = $('ul.myui-content__list');
  89. for(let i=0;i<playList.length;i++) {
  90. playFroms.push('leospring' + (i+1));
  91. playUrls.push(_.map($(playList[i]).find('a'), item => {
  92. return $(item).attr('title') + '$' + $(item).attr('href');
  93. }).join('#'))
  94. }
  95. const vod = {
  96. vod_id: id,
  97. vod_actor: _.map($('div.myui-content__detail > p:nth-child(5) > a'), item => $(item).text()).join(' '),
  98. vod_play_from: playFroms.join('$$$'),
  99. vod_play_url: playUrls.join('$$$'),
  100. vod_content: $('div.myui-panel-box > p.text-muted:nth-child(1)').text(),
  101. }
  102. return JSON.stringify({
  103. list: [vod],
  104. });
  105. }
  106. async function play(flag, id, flags) {
  107. const url = HOST + id;
  108. const $ = load(await request(url));
  109. const encUrl = $('script:contains(var now=)').html().split('var now="')[1].split('";')[0].split('|')[0];
  110. if(encUrl.endsWith('.mp4')) {
  111. return JSON.stringify({
  112. parse: 0,
  113. url: 'https://v.damoli.pro/v/' + encUrl,
  114. header: {
  115. 'User-Agent': MOBILE_UA,
  116. 'Referer': HOST,
  117. },
  118. });
  119. }
  120. let parseUrl = HOST + '/api/webvideo_ty.php?url=' + encUrl + '&type=json';
  121. if(encUrl.length === 32) {
  122. parseUrl = HOST + '/api/webvideo.php?url=' + encUrl + '&type=json';
  123. }
  124. //console.log('parseUrl', parseUrl);
  125. const encData = JSON.parse(await request(parseUrl)).url;
  126. const realUrl = DecryptUrl(encData);
  127. return JSON.stringify({
  128. parse: 0,
  129. url: realUrl,
  130. });
  131. }
  132. function DecryptUrl(encData) {
  133. const b64Data = base64Decode(encData);
  134. //console.log('b64Data', b64Data);
  135. let url = '';
  136. for(let i=0;i<b64Data.length;i++){
  137. let idx = i % 8;
  138. url += String.fromCharCode(b64Data.charCodeAt(i) ^ 'ItLdg666'.charCodeAt(idx));
  139. }
  140. //console.log('url', url);
  141. return base64Decode(url);
  142. }
  143. function base64Decode(text) {
  144. return Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(text));
  145. }
  146. async function search(wd, quick) {
  147. let url = HOST + '/search.php?searchword=' + wd;
  148. const $ = load(await request(url));
  149. const videos = _.map($('div > a.myui-vodlist__thumb'), item => {
  150. return {
  151. vod_id: $(item).attr('href'),
  152. vod_name: $(item).attr('title'),
  153. vod_pic: $(item).attr('data-original'),
  154. vod_remarks: $($(item).find('span.pic-text')).text().trim(),
  155. vod_year: $($(item).find('span.pic-tag')).text().trim(),
  156. }
  157. });
  158. return JSON.stringify({
  159. list: videos,
  160. limit: 50,
  161. });
  162. }
  163. export function __jsEvalReturn() {
  164. return {
  165. init: init,
  166. home: home,
  167. homeVod: homeVod,
  168. category: category,
  169. detail: detail,
  170. play: play,
  171. search: search,
  172. };
  173. }