qfys_open.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { Crypto, load, _, jinja2 } from './lib/cat.js';
  2. let key = 'qfys';
  3. let HOST = 'https://fun.tvoled.net';
  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, agentSp) {
  8. let res = await req(reqUrl, {
  9. method: 'get',
  10. headers: {
  11. 'User-Agent': agentSp || UA,
  12. 'Referer': HOST
  13. },
  14. });
  15. return res.content;
  16. }
  17. // cfg = {skey: siteKey, ext: extend}
  18. async function init(cfg) {
  19. siteKey = cfg.skey;
  20. siteType = cfg.stype;
  21. }
  22. async function home(filter) {
  23. let classes = [{"type_id":1,"type_name":"电影"},{"type_id":2,"type_name":"追剧"},{"type_id":3,"type_name":"综艺"},{"type_id":4,"type_name":"动漫"}];
  24. let filterObj = {
  25. "1":[{"key":"cateId","name":"类型","value":[{"n":"全部","v":"1"},{"n":"灾难片","v":"20"},{"n":"冒险片","v":"21"},{"n":"同性片","v":"22"},{"n":"惊悚片","v":"23"},{"n":"悬疑片","v":"25"},{"n":"经典片","v":"26"},{"n":"犯罪片","v":"27"},{"n":"动作片","v":"6"},{"n":"喜剧片","v":"7"},{"n":"爱情片","v":"8"},{"n":"科幻片","v":"9"},{"n":"恐怖片","v":"10"},{"n":"剧情片","v":"11"},{"n":"战争片","v":"12"}]},{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"喜剧","v":"/class/喜剧"},{"n":"爱情","v":"/class/爱情"},{"n":"恐怖","v":"/class/恐怖"},{"n":"动作","v":"/class/动作"},{"n":"科幻","v":"/class/科幻"},{"n":"剧情","v":"/class/剧情"},{"n":"战争","v":"/class/战争"},{"n":"犯罪","v":"/class/犯罪"},{"n":"动画","v":"/class/动画"},{"n":"奇幻","v":"/class/奇幻"},{"n":"武侠","v":"/class/武侠"},{"n":"冒险","v":"/class/冒险"},{"n":"恐怖","v":"/class/恐怖"},{"n":"悬疑","v":"/class/悬疑"},{"n":"惊悚","v":"/class/惊悚"},{"n":"历史","v":"/class/历史"},{"n":"运动","v":"/class/运动"},{"n":"儿童","v":"/class/儿童"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"/area/大陆"},{"n":"香港","v":"/area/香港"},{"n":"台湾","v":"/area/台湾"},{"n":"美国","v":"/area/美国"},{"n":"韩国","v":"/area/韩国"},{"n":"法国","v":"/area/法国"},{"n":"英国","v":"/area/英国"},{"n":"日本","v":"/area/日本"},{"n":"德国","v":"/area/德国"},{"n":"泰国","v":"/area/泰国"},{"n":"印度","v":"/area/印度"},{"n":"意大利","v":"/area/意大利"},{"n":"西班牙","v":"/area/西班牙"},{"n":"加拿大","v":"/area/加拿大"},{"n":"其他","v":"/area/其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"/year/2023"},{"n":"2022","v":"/year/2022"},{"n":"2021","v":"/year/2021"},{"n":"2020","v":"/year/2020"},{"n":"2019","v":"/year/2019"},{"n":"2018","v":"/year/2018"},{"n":"2017","v":"/year/2017"},{"n":"2016","v":"/year/2016"},{"n":"2015","v":"/year/2015"},{"n":"2014","v":"/year/2014"},{"n":"2013","v":"/year/2013"},{"n":"2012","v":"/year/2012"},{"n":"2011","v":"/year/2011"},{"n":"2010","v":"/year/2010"},{"n":"2009","v":"/year/2009"},{"n":"2008","v":"/year/2008"},{"n":"2006","v":"/year/2006"},{"n":"2005","v":"/year/2005"},{"n":"2004","v":"/year/2004"},{"n":"2003","v":"/year/2003"},{"n":"2002","v":"/year/2002"},{"n":"2001","v":"/year/2001"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"/by/time"},{"n":"人气","v":"/by/hits"},{"n":"评分","v":"/by/score"}]}],
  26. "2":[{"key":"cateId","name":"类型","value":[{"n":"全部","v":"2"},{"n":"泰新马","v":"24"},{"n":"国产剧","v":"13"},{"n":"港台剧","v":"14"},{"n":"日韩剧","v":"15"},{"n":"欧美剧","v":"16"}]},{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"剧情","v":"/class/剧情"},{"n":"爱情","v":"/class/爱情"},{"n":"古装","v":"/class/古装"},{"n":"悬疑","v":"/class/悬疑"},{"n":"战争","v":"/class/战争"},{"n":"喜剧","v":"/class/喜剧"},{"n":"家庭","v":"/class/家庭"},{"n":"犯罪","v":"/class/犯罪"},{"n":"动作","v":"/class/动作"},{"n":"奇幻","v":"/class/奇幻"},{"n":"历史","v":"/class/历史"},{"n":"短剧","v":"/class/短剧"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"/area/大陆"},{"n":"韩国","v":"/area/韩国"},{"n":"香港","v":"/area/香港"},{"n":"台湾","v":"/area/台湾"},{"n":"日本","v":"/area/日本"},{"n":"美国","v":"/area/美国"},{"n":"泰国","v":"/area/泰国"},{"n":"英国","v":"/area/英国"},{"n":"新加坡","v":"/area/新加坡"},{"n":"其他","v":"/area/其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"/year/2023"},{"n":"2022","v":"/year/2022"},{"n":"2021","v":"/year/2021"},{"n":"2020","v":"/year/2020"},{"n":"2019","v":"/year/2019"},{"n":"2018","v":"/year/2018"},{"n":"2017","v":"/year/2017"},{"n":"2016","v":"/year/2016"},{"n":"2015","v":"/year/2015"},{"n":"2014","v":"/year/2014"},{"n":"2013","v":"/year/2013"},{"n":"2012","v":"/year/2012"},{"n":"2011","v":"/year/2011"},{"n":"2010","v":"/year/2010"},{"n":"2009","v":"/year/2009"},{"n":"2008","v":"/year/2008"},{"n":"2006","v":"/year/2006"},{"n":"2005","v":"/year/2005"},{"n":"2004","v":"/year/2004"},{"n":"2003","v":"/year/2003"},{"n":"2002","v":"/year/2002"},{"n":"2001","v":"/year/2001"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"/by/time"},{"n":"人气","v":"/by/hits"},{"n":"评分","v":"/by/score"}]}],
  27. "3":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"选秀","v":"/class/选秀"},{"n":"情感","v":"/class/情感"},{"n":"访谈","v":"/class/访谈"},{"n":"播报","v":"/class/播报"},{"n":"旅游","v":"/class/旅游"},{"n":"音乐","v":"/class/音乐"},{"n":"美食","v":"/class/美食"},{"n":"纪实","v":"/class/纪实"},{"n":"曲艺","v":"/class/曲艺"},{"n":"生活","v":"/class/生活"},{"n":"游戏互动","v":"/class/游戏互动"},{"n":"财经","v":"/class/财经"},{"n":"求职","v":"/class/求职"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"大陆","v":"/area/大陆"},{"n":"香港","v":"/area/香港"},{"n":"台湾","v":"/area/台湾"},{"n":"日本","v":"/area/日本"},{"n":"韩国","v":"/area/韩国"},{"n":"欧美","v":"/area/欧美"},{"n":"其它","v":"/area/其它"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"/year/2023"},{"n":"2022","v":"/year/2022"},{"n":"2021","v":"/year/2021"},{"n":"2020","v":"/year/2020"},{"n":"2019","v":"/year/2019"},{"n":"2018","v":"/year/2018"},{"n":"2017","v":"/year/2017"},{"n":"2016","v":"/year/2016"},{"n":"2015","v":"/year/2015"},{"n":"2014","v":"/year/2014"},{"n":"2013","v":"/year/2013"},{"n":"2012","v":"/year/2012"},{"n":"2011","v":"/year/2011"},{"n":"2010","v":"/year/2010"},{"n":"2009","v":"/year/2009"},{"n":"2008","v":"/year/2008"},{"n":"2006","v":"/year/2006"},{"n":"2005","v":"/year/2005"},{"n":"2004","v":"/year/2004"},{"n":"2003","v":"/year/2003"},{"n":"2002","v":"/year/2002"},{"n":"2001","v":"/year/2001"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"/by/time"},{"n":"人气","v":"/by/hits"},{"n":"评分","v":"/by/score"}]}],
  28. "4":[{"key":"class","name":"剧情","value":[{"n":"全部","v":""},{"n":"情感","v":"/class/情感"},{"n":"科幻","v":"/class/科幻"},{"n":"热血","v":"/class/热血"},{"n":"推理","v":"/class/推理"},{"n":"搞笑","v":"/class/搞笑"},{"n":"冒险","v":"/class/冒险"},{"n":"萝莉","v":"/class/萝莉"},{"n":"校园","v":"/class/校园"},{"n":"动作","v":"/class/动作"},{"n":"机战","v":"/class/机战"},{"n":"运动","v":"/class/运动"},{"n":"战争","v":"/class/战争"},{"n":"少年","v":"/class/少年"},{"n":"少女","v":"/class/少女"},{"n":"社会","v":"/class/社会"},{"n":"原创","v":"/class/原创"},{"n":"亲子","v":"/class/亲子"},{"n":"益智","v":"/class/益智"},{"n":"励志","v":"/class/励志"},{"n":"其他","v":"/class/其他"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":""},{"n":"国产","v":"/area/国产"},{"n":"日本","v":"/area/日本"},{"n":"欧美","v":"/area/欧美"},{"n":"其他","v":"/area/其他"}]},{"key":"year","name":"年份","value":[{"n":"全部","v":""},{"n":"2023","v":"/year/2023"},{"n":"2022","v":"/year/2022"},{"n":"2021","v":"/year/2021"},{"n":"2020","v":"/year/2020"},{"n":"2019","v":"/year/2019"},{"n":"2018","v":"/year/2018"},{"n":"2017","v":"/year/2017"},{"n":"2016","v":"/year/2016"},{"n":"2015","v":"/year/2015"},{"n":"2014","v":"/year/2014"},{"n":"2013","v":"/year/2013"},{"n":"2012","v":"/year/2012"},{"n":"2011","v":"/year/2011"},{"n":"2010","v":"/year/2010"},{"n":"2009","v":"/year/2009"},{"n":"2008","v":"/year/2008"},{"n":"2006","v":"/year/2006"},{"n":"2005","v":"/year/2005"},{"n":"2004","v":"/year/2004"},{"n":"2003","v":"/year/2003"},{"n":"2002","v":"/year/2002"},{"n":"2001","v":"/year/2001"}]},{"key":"by","name":"排序","value":[{"n":"时间","v":"/by/time"},{"n":"人气","v":"/by/hits"},{"n":"评分","v":"/by/score"}]}]
  29. };
  30. return JSON.stringify({
  31. class: classes,
  32. filters: filterObj,
  33. });
  34. }
  35. async function homeVod() {}
  36. async function category(tid, pg, filter, extend) {
  37. if (pg <= 0) pg = 1;
  38. const link = HOST + '/index.php/vod/show' + (extend.area || '') + (extend.by || '/by/time') + (extend.class || '') + '/id/' + (extend.cateId || tid) + '/page/' + pg + (extend.year || '') + '.html';//https://fun.tvoled.net/index.php/vod/show/area/%E5%A4%A7%E9%99%86/by/hits/class/%E5%8F%A4%E8%A3%85/id/13/year/2022.html
  39. const html = await request(link);
  40. const $ = load(html);
  41. const items = $('div.module a.module-poster-item');
  42. let videos = _.map(items, (item) => {
  43. const it = $(item)[0];
  44. const k = $(item).find('img:first')[0];
  45. const remarks = $($(item).find('div.module-item-note')[0]).text().trim();
  46. return {
  47. vod_id: it.attribs.href.replace(/.*?\/id\/(.*).html/g, '$1'),
  48. vod_name: it.attribs.title,
  49. vod_pic: k.attribs['data-original'],
  50. vod_remarks: remarks || '',
  51. };
  52. });
  53. const hasMore = $('div#page > a:contains(下一页)').length > 0;
  54. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  55. return JSON.stringify({
  56. page: parseInt(pg),
  57. pagecount: pgCount,
  58. limit: 24,
  59. total: 24 * pgCount,
  60. list: videos,
  61. });
  62. }
  63. async function detail(id) {
  64. var html = await request( HOST + '/index.php/vod/detail/id/' + id + '.html');
  65. var $ = load(html);
  66. var vod = {
  67. vod_id: id,
  68. vod_name: $('h1:first').text().trim(),
  69. vod_type: $('.module-info-tag a').text(),
  70. vod_actor: $('.module-info-items a').text(),
  71. vod_pic: $('.video-cover img:first').attr('src'),
  72. vod_remarks : $('.stui-content__detail p:nth-child(5)').text() || '',
  73. vod_content: $('.show-desc p').text().trim(),
  74. };
  75. var playMap = {};
  76. var tabs = $('div.module-tab-items-box div.module-tab-item');
  77. var playlists = $('div.module-play-list-content');
  78. _.each(tabs, (tab, i) => {
  79. var from = $(tab).text();
  80. var list = playlists[i];
  81. list = $(list).find('a');
  82. _.each(list, (it) => {
  83. var title = $(it).text();
  84. var playUrl = it.attribs.href.replace(/.*?\/id\/(.*).html/g, '$1');
  85. if (title.length == 0) title = it.children[0].data.trim();
  86. if (!playMap.hasOwnProperty(from)) {
  87. playMap[from] = [];
  88. }
  89. playMap[from].push( title + '$' + playUrl);
  90. });
  91. });
  92. vod.vod_play_from = _.keys(playMap).join('$$$');
  93. var urls = _.values(playMap);
  94. var vod_play_url = _.map(urls, (urlist) => {
  95. return urlist.join('#');
  96. });
  97. vod.vod_play_url = vod_play_url.join('$$$');
  98. return JSON.stringify({
  99. list: [vod],
  100. });
  101. }
  102. async function play(flag, id, flags) {
  103. const link = HOST + '/index.php/vod/play/id/' + id + '.html';
  104. const html = await request(link);
  105. const $ = load(html);
  106. const js = JSON.parse($('script:contains(player_)').html().replace('var player_aaaa=',''));
  107. const playUrl = js.url;
  108. return JSON.stringify({
  109. parse: 0,
  110. url: playUrl,
  111. });
  112. }
  113. async function search(wd, quick, pg) {
  114. if (pg <= 0) pg = 1;
  115. let data = await request(HOST + '/index.php/vod/search/page/' + pg + '/wd/' + wd + '.html');//https://fun.tvoled.net/index.php/vod/search/page/2/wd/%E6%88%91.html
  116. const $ = load(data);
  117. const items = $('div.module-items div.module-item');
  118. let videos = _.map(items, (item) => {
  119. const it = $(item).find('a:first')[0];
  120. const k = $(item).find('img:first')[0];
  121. const remarks = $($(item).find('div.module-item-note')[0]).text().trim();
  122. return {
  123. vod_id: it.attribs.href.replace(/.*?\/id\/(.*).html/g, '$1'),
  124. vod_name: k.attribs.alt,
  125. vod_pic: k.attribs['data-original'],
  126. vod_remarks: remarks || '',
  127. };
  128. });
  129. const hasMore = $('div#page > a:contains(下一页)').length > 0;
  130. const pgCount = hasMore ? parseInt(pg) + 1 : parseInt(pg);
  131. return JSON.stringify({
  132. page: parseInt(pg),
  133. pagecount: pgCount,
  134. limit: 24,
  135. total: 24 * pgCount,
  136. list: videos,
  137. });
  138. }
  139. export function __jsEvalReturn() {
  140. return {
  141. init: init,
  142. home: home,
  143. homeVod: homeVod,
  144. category: category,
  145. detail: detail,
  146. play: play,
  147. search: search,
  148. };
  149. }