xdys_open.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. // 兄弟影视发布页 https://xdys.vip/
  3. let key = 'xdys';
  4. let HOST = 'https://www.brovod.com';
  5. const parseUrl = 'https://play.brovod.com/?url=';
  6. const parseUrl2 = 'https://pl.qcheng.cc/hktvpc.php?url=';
  7. let parseMap = {};
  8. let siteKey = '';
  9. let siteType = 0;
  10. 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';
  11. async function request(reqUrl) {
  12. let res = await req(reqUrl, {
  13. method: 'get',
  14. headers: {
  15. 'User-Agent': UA,
  16. 'Referer': HOST
  17. },
  18. });
  19. return res.content;
  20. }
  21. // cfg = {skey: siteKey, ext: extend}
  22. async function init(cfg) {
  23. siteKey = cfg.skey;
  24. siteType = cfg.stype;
  25. //await initParseMap();
  26. //console.log(parseMap);
  27. }
  28. /**
  29. * 构造筛选数据
  30. */
  31. async function genFilterInfo(url) {
  32. const $ = load(await request(url));
  33. const list = _.map($('div.module-item-box > a'), item => {
  34. return {'n': $(item).text(), 'v': $(item).text().replace('全部', '')}
  35. });
  36. console.log('list', JSON.stringify(list));
  37. }
  38. async function initParseMap() {
  39. const date = new Date();
  40. const t = '' + date.getFullYear() + (date.getMonth() + 1) + date.getDate();
  41. const js = await request(HOST + '/static/js/playerconfig.js?t=' + t);
  42. try {
  43. const playerList = JSON.parse(js.split('MacPlayerConfig.player_list=')[1].split(',MacPlayerConfig.downer_list')[0]);
  44. const players = _.values(playerList);
  45. _.each(players, (item) => {
  46. if (!item.ps || item.ps == '0') return;
  47. if (_.isEmpty(item.parse)) return;
  48. parseMap[item.show] = item.parse;
  49. });
  50. } catch(e) {
  51. console.log('error', e);
  52. }
  53. }
  54. async function home(filter) {
  55. const classes = [{'type_id':'1','type_name':'电影'},{'type_id':'2','type_name':'电视剧'},{'type_id':'3','type_name':'综艺'},{'type_id':'4','type_name':'动漫'},{'type_id':'5','type_name':'纪录片'},{'type_id':'6','type_name':'短剧'}];
  56. const filterObj = {
  57. '1':[{'key':'cateId','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":"惊悚"}]},{'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":"其他"}]},{'key':'lan','name':'语言','init':'','value':[{'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':'2024','v':'2024'},{'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"}]}],
  58. '2':[{'key':'cateId','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":"其他"}]},{'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":""}]},{'key':'lan','name':'语言','init':'','value':[{'n':"国语","v":"国语"},{'n':"英语","v":"英语"},{'n':"粤语","v":"粤语"},{'n':"韩语","v":"韩语"},{'n':"日语","v":"日语"},{'n':"其它","v":"其它"},{'n':"全部","v":""}]},{'key':'year','name':'年代','init':'','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'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"}]}],
  59. '3':[{'key':'cateId','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":""}]},{'key':'area','name':'地区','init':'','value':[{'n':"大陆","v":"大陆"},{'n':"港台","v":"港台"},{'n':"日韩","v":"日韩"},{'n':"欧美","v":"欧美"}]},{'key':'lan','name':'语言','init':'','value':[{'n':"全部","v":""},{'n':"国语","v":"国语"},{'n':"英语","v":"英语"},{'n':"粤语","v":"粤语"},{'n':"韩语","v":"韩语"},{'n':"日语","v":"日语"},{'n':"其它","v":"其它"}]},{'key':'year','name':'年代','init':'','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'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"}]}],
  60. '4':[{'key':'cateId','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":"其他"}]},{'key':'area','name':'地区','init':'','value':[{'n':"全部","v":""},{'n':"大陆","v":"大陆"},{'n':"日本","v":"日本"},{'n':"欧美","v":"欧美"},{'n':"其他","v":"其他"}]},{'key':'lan','name':'语言','init':'','value':[{'n':"全部","v":""},{'n':"国语","v":"国语"},{'n':"英语","v":"英语"},{'n':"粤语","v":"粤语"},{'n':"韩语","v":"韩语"},{'n':"日语","v":"日语"},{'n':"其它","v":"其它"}]},{'key':'year','name':'年代','init':'','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'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"}]}],
  61. '5':[{'key':'cateId','name':'类型','init':'','value':[{'n':"全部","v":""},{'n':"BBC","v":"BBC"},{'n':"Discovery","v":"Discovery"},{'n':"历史","v":"历史"},{'n':"人物","v":"人物"},{'n':"美食","v":"美食"},{'n':"节日","v":"节日"}]},{'key':'area','name':'地区','init':'','value':[{'n':"全部","v":""},{'n':"大陆","v":"大陆"},{'n':"海外","v":"海外"}]},{'key':'lan','name':'语言','init':'','value':[{'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':'2024','v':'2024'},{'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"}]}],
  62. '6':[{'key':'cateId','name':'类型','init':'','value':[{'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":"其他"}]},{'key':'lan','name':'语言','init':'','value':[{'n':"全部","v":""},{'n':"国语","v":"国语"}]},{'key':'year','name':'年代','init':'','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'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"}]}],
  63. };
  64. return JSON.stringify({
  65. class: classes,
  66. filters: filterObj,
  67. });
  68. }
  69. async function homeVod() {}
  70. async function category(tid, pg, filter, extend) {
  71. if (pg <= 0) pg = 1;
  72. const link = HOST + '/show/' + (extend.cateId || tid) + '-' + (extend.area || '') + '-' + (extend.by || '') + '-' + (extend.cateId || '') + '-' + (extend.lan || '') + '----' + pg + '---' + (extend.year || '') + '/';
  73. const html = await request(link);
  74. const $ = load(html);
  75. const items = $('a.module-item');
  76. const videos = _.map(items, (item) => {
  77. const $item = $(item);
  78. const a = $item;
  79. const img = $item.find('img:first');
  80. const remarks = $item.find('div.module-item-note').text().trim();
  81. return {
  82. vod_id: a.attr('href').replace(/.*?\/detail\/(.*).html/g, '$1'),
  83. vod_name: a.attr('title'),
  84. vod_pic: img.attr('data-original'),
  85. vod_remarks: remarks,
  86. };
  87. });
  88. const limit = 72;
  89. const hasMore = $('div#page > a:contains(下一页)').length > 0;
  90. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  91. return JSON.stringify({
  92. page: parseInt(pg),
  93. pagecount: pgCount,
  94. limit: limit,
  95. total: limit * pgCount,
  96. list: videos,
  97. });
  98. }
  99. async function detail(id) {
  100. const html = await request(HOST + id);
  101. const $ = load(html);
  102. const vod = {
  103. vod_id: id,
  104. vod_name: $('h1:first').text().trim(),
  105. vod_type: $('.module-info-tag a:eq(2)').text().trim(),
  106. vod_year: $('.module-info-tag a:eq(0)').text().trim(),
  107. vod_area: $('.module-info-tag a:eq(1)').text().trim(),
  108. vod_actor: $('.module-info-item:contains(主演:)').text().trim().substring(3).replace(/\/$/, ''),
  109. vod_director: $('.module-info-item:contains(导演:)').text().trim().substring(3).replace(/\/$/, ''),
  110. vod_pic: $('.module-info-poster img:first').attr('data-original'),
  111. vod_remarks : $('.module-info-item:contains(备注:)').text(),
  112. vod_content: $('.module-info-introduction-content').text().trim(),
  113. };
  114. const playMap = {};
  115. const tabs = $('.module-tab .module-tab-item span');
  116. const playlists = $('.module-play-list');
  117. _.each(tabs, (tab, i) => {
  118. const $tab = $(tab);
  119. const from = $tab.text().trim();
  120. let list = playlists[i];
  121. list = $(list).find('a');
  122. _.each(list, (it) => {
  123. const $it = $(it);
  124. let title = $it.find('span').text();
  125. const playUrl = $it.attr('href');
  126. if (_.isEmpty(title)) title = $it.text();
  127. if (!playMap.hasOwnProperty(from)) {
  128. playMap[from] = [];
  129. }
  130. playMap[from].push(title + '$' + playUrl);
  131. });
  132. });
  133. vod.vod_play_from = _.keys(playMap).join('$$$');
  134. const urls = _.values(playMap);
  135. const vod_play_url = _.map(urls, (urlist) => {
  136. return urlist.join('#');
  137. });
  138. vod.vod_play_url = vod_play_url.join('$$$');
  139. return JSON.stringify({
  140. list: [vod],
  141. });
  142. }
  143. async function play(flag, id, flags) {
  144. const link = HOST + id;
  145. const html = await request(link);
  146. const $ = load(html);
  147. const js = JSON.parse($('script:contains(player_)').html().replace('var player_aaaa=',''));
  148. let playUrl = js.url;
  149. if (js.encrypt == 1) {
  150. playUrl = unescape(playUrl);
  151. } else if (js.encrypt == 2) {
  152. playUrl = unescape(base64Decode(playUrl));
  153. }
  154. //const parseUrl = parseMap[from];
  155. if (parseUrl) {
  156. if (js.from == 'mytv') {
  157. const reqUrl = parseUrl2 + playUrl;
  158. const parseHtml = await request(reqUrl);
  159. const matches = parseHtml.match(/innerHTML = '<video src="([\w\W]*)" controls=/);
  160. if (!_.isEmpty(matches)) {
  161. playUrl = matches[1].trim();
  162. }
  163. } else {
  164. const reqUrl = parseUrl + playUrl;
  165. let html = await request(reqUrl);
  166. //console.log(html);
  167. //"dmkey": "a97b811c47cb503f5ab45aa6c8a9628d",
  168. let dmkey = html.split('dmkey":"')[1].split('",')[0];
  169. //console.log('json', dmkey);
  170. let key = sha256(parseInt(new Date().getTime()/1000/3600)*3600 + 'brovod');
  171. const res = await req('https://jx.xdys.vip/v1/jx', {
  172. data: {
  173. dmkey: dmkey,
  174. url: playUrl,
  175. pbgjz: 'A',
  176. key: key
  177. },
  178. method: 'post',
  179. headers: {
  180. 'Content-Type': 'text/plain'
  181. },
  182. });
  183. //console.log('res', res);
  184. if (res) {
  185. playUrl = JSON.parse(res.content).jarod;
  186. }
  187. // const parseHtml = await request(reqUrl);
  188. // const matches = parseHtml.match(/let ConFig = {([\w\W]*)},box/);
  189. // if (!_.isEmpty(matches)) {
  190. // const configJson = '{' + matches[1].trim() + '}';
  191. // const config = JSON.parse(configJson);
  192. // playUrl = decryptUrl(config);
  193. // }
  194. }
  195. }
  196. return JSON.stringify({
  197. parse: 0,
  198. url: playUrl,
  199. header: {
  200. 'User-Agent': UA,
  201. }
  202. });
  203. }
  204. function decryptUrl(jsConfig) {
  205. const key = Crypto.enc.Utf8.parse('2890' + jsConfig.config.uid + 'tB959C');
  206. const iv = Crypto.enc.Utf8.parse('2F131BE91247866E');
  207. const mode = Crypto.mode.CBC;
  208. const padding = Crypto.pad.Pkcs7;
  209. const decrypted = Crypto.AES.decrypt(jsConfig.url, key, {
  210. iv: iv,
  211. mode: mode,
  212. padding: padding
  213. });
  214. const decryptedUrl = Crypto.enc.Utf8.stringify(decrypted);
  215. return decryptedUrl;
  216. }
  217. function sha256(str) {
  218. return Crypto.SHA256(str).toString(Crypto.enc.Hex);
  219. }
  220. async function search(wd, quick) {
  221. const data = JSON.parse(await request(HOST + '/index.php/ajax/suggest?mid=1&limit=50&wd=' + wd)).list;
  222. const videos = _.map(data, (vod) => {
  223. return {
  224. vod_id: '/detail/'+vod.id,
  225. vod_name: vod.name,
  226. vod_pic: vod.pic,
  227. vod_remarks: '',
  228. };
  229. });
  230. return JSON.stringify({
  231. list: videos,
  232. });
  233. }
  234. export function __jsEvalReturn() {
  235. return {
  236. init: init,
  237. home: home,
  238. homeVod: homeVod,
  239. category: category,
  240. detail: detail,
  241. play: play,
  242. search: search,
  243. };
  244. }