nangua_open.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import { Crypto,_} from './lib/cat.js';
  2. let siteUrl = 'http://ys.changmengyun.com';
  3. let siteKey = '';
  4. let siteType = 0;
  5. async function request(reqUrl){
  6. let res = await req(reqUrl, {
  7. headers: getHeaders(),
  8. method: 'get',
  9. });
  10. return res.content;
  11. }
  12. async function init(cfg) {
  13. siteKey = cfg.skey;
  14. siteType = cfg.stype;
  15. }
  16. async function home(filter) {
  17. return JSON.stringify({
  18. 'class': [{'type_id':'2','type_name':'电视剧'},{'type_id':'1','type_name':'电影'},{'type_id':'4','type_name':'动漫'},{'type_id':'3','type_name':'综艺'},{'type_id':'46','type_name':'海外精选'}],
  19. 'filters': {
  20. "2":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"国产剧","v":"国产剧"},{"n":"港台剧","v":"港台剧"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":"地区"},{"n":"内地","v":"内地"},{"n":"香港地区","v":"香港地区"},{"n":"台湾地区","v":"台湾地区"}]},{"key":"year","name":"年份","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":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}],
  21. "1":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"动作片","v":"动作片"},{"n":"喜剧片","v":"喜剧片"},{"n":"爱情片","v":"爱情片"},{"n":"科幻片","v":"科幻片"},{"n":"恐怖片","v":"恐怖片"},{"n":"剧情片","v":"剧情片"},{"n":"战争片","v":"战争片"},{"n":"惊悚片","v":"惊悚片"}]},{"key":"area","name":"地区","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":"year","name":"年份","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":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}],
  22. "4":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"国产漫","v":"国产漫"},{"n":"欧美漫","v":"欧美漫"},{"n":"日韩漫","v":"日韩漫"},{"n":"港台漫","v":"港台漫"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":"地区"},{"n":"中国大陆","v":"中国大陆"},{"n":"日本","v":"日本"},{"n":"韩国","v":"韩国"},{"n":"欧美","v":"欧美"},{"n":"其它","v":"其它"}]},{"key":"year","name":"年份","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":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"新上线","v":"新上线"}]},{"key":"total","name":"状态","value":[{"n":"全部","v":"状态"},{"n":"连载","v":"连载"},{"n":"完结","v":"完结"}]}],
  23. "3":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"大陆","v":"大陆"},{"n":"港台","v":"港台"},{"n":"日韩","v":"日韩"},{"n":"欧美","v":"欧美"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":"地区"},{"n":"内地","v":"内地"},{"n":"港台","v":"港台"},{"n":"日韩","v":"日韩"},{"n":"欧美","v":"欧美"},{"n":"其它","v":"其它"}]},{"key":"year","name":"年份","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":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"新上线","v":"新上线"}]}],
  24. "46":[{"key":"class","name":"类型","value":[{"n":"全部","v":"类型"},{"n":"日韩剧","v":"日韩剧"},{"n":"欧美剧","v":"欧美剧"},{"n":"海外剧","v":"海外剧"}]},{"key":"area","name":"地区","value":[{"n":"全部","v":"地区"},{"n":"韩国","v":"韩国"},{"n":"美剧","v":"美剧"},{"n":"日本","v":"日本"},{"n":"泰国","v":"泰国"},{"n":"英国","v":"英国"},{"n":"新加坡","v":"新加坡"},{"n":"其他","v":"其他"}]},{"key":"year","name":"年份","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":"10年代","v":"10年代"},{"n":"00年代","v":"00年代"},{"n":"90年代","v":"90年代"},{"n":"80年代","v":"80年代"}]},{"key":"by","name":"排序","value":[{"n":"热播榜","v":"热播榜"},{"n":"好评榜","v":"好评榜"},{"n":"新上线","v":"新上线"}]}]
  25. },
  26. });
  27. }
  28. async function homeVod() {
  29. try {
  30. let url = siteUrl + '/api.php/provide/vod_rank?app=ylys&sort_type=month&imei=c431ea542cee9679&id=2&page=1';
  31. let data = await request(url);
  32. let res = JSON.parse(data);
  33. let videos = _.map(res, (vod) => {
  34. return {
  35. vod_id: vod.id,
  36. vod_name: vod.name,
  37. vod_pic: vod.img,
  38. vod_remarks: vod.remarks,
  39. }
  40. });
  41. return JSON.stringify({
  42. list: videos,
  43. });
  44. } catch (error) {
  45. //console.log('error', error);
  46. }
  47. }
  48. async function category(tid, pg, filter, extend) {
  49. if(pg <= 0) pg = 1;
  50. let area = extend['area']?extend['area']:'';
  51. let year = extend['year']?extend['year']:'';
  52. let type = extend['class']?extend['class']:'';
  53. let url = siteUrl + '/api.php/provide/vod_list?app=ylys&id='+tid+'&area='+ area +'&year='+year+'&type='+type+'&page='+pg+'&imei=c431ea542cee9679';
  54. let res = JSON.parse(await request(url));
  55. let videos = _.map(res['list'], (vod) => {
  56. return {
  57. vod_id: vod.id,
  58. vod_name: vod.name,
  59. vod_pic: vod.img,
  60. vod_remarks: vod.msg,
  61. }
  62. });
  63. return JSON.stringify({
  64. page: pg,
  65. limit: res['limit'],
  66. list: videos,
  67. });
  68. }
  69. async function detail(id) {
  70. let data = JSON.parse(await request(siteUrl + '/api.php/provide/vod_detail?app=ylys&imei=c431ea542cee9679&id=' + id))['data'];
  71. let vod = {
  72. vod_name: data.name,
  73. vod_pic: data.img,
  74. type_name: data.type,
  75. vod_year: data.year,
  76. vod_remarks: data.msg,
  77. vod_content: '💕一个分享者💕' + data.info,
  78. };
  79. let episodes = data.player_info;
  80. let playFroms = [];
  81. let playUrls = [];
  82. for (let i=0;i<episodes.length;i++) {
  83. let episode = episodes[i];
  84. playFroms.push(episode.show);
  85. let nameUrls = [];
  86. for (const play of episode.video_info) {
  87. nameUrls.push(play.name + '$' + play['url'][0]);
  88. }
  89. playUrls.push(nameUrls.join('#'));
  90. }
  91. vod.vod_play_from = playFroms.join('$$$');
  92. vod.vod_play_url = playUrls.join('$$$');
  93. return JSON.stringify({
  94. list: [vod],
  95. });
  96. }
  97. async function play(flag, id, flags) {
  98. try {
  99. let input = {parse: 0,url: id,};
  100. if (id.indexOf(',') > 0) {
  101. let mjurl = id.split(',')[1]
  102. let videoUrl = await getvideo(mjurl);
  103. input = {
  104. jx: 0,
  105. url: videoUrl,
  106. parse: 0,
  107. header: JSON.stringify({
  108. 'user-agent': 'Lavf/58.12.100'
  109. })
  110. }
  111. } else {
  112. let videoUrl = await getvideo(id);
  113. if (videoUrl.indexOf('jhapi') > 0) {
  114. videoUrl = await getvideo(videoUrl);
  115. input = {
  116. jx: 0,
  117. url: videoUrl,
  118. parse: 0,
  119. header: JSON.stringify({
  120. 'user-agent': 'Lavf/58.12.100'
  121. })
  122. }
  123. } else {
  124. input = {
  125. jx: 0,
  126. url: videoUrl,
  127. parse: 0
  128. }
  129. }
  130. }
  131. return JSON.stringify(input);
  132. } catch (e) {
  133. return JSON.stringify({
  134. parse: 0,
  135. url: id,
  136. });
  137. }
  138. }
  139. async function getvideo(url) {
  140. let jData = JSON.parse(await request(url));
  141. if (jData.code == 1) {
  142. return jData.data.url
  143. } else {
  144. return 'http://43.154.104.152:1234/jhapi/cs.php?url=' + url.split('=')[1]
  145. }
  146. }
  147. async function search(wd, quick, pg) {
  148. let page = pg || 1;
  149. if (page == 0) page = 1;
  150. let data = JSON.parse(await request(siteUrl + '/api.php/provide/search_result_more?app=ylys&video_name='+wd+'&pageSize=20&tid=0&imei=c431ea542cee9679&page='+page));
  151. let videos = [];
  152. for (const vod of data.data) {
  153. videos.push({
  154. vod_id: vod.id,
  155. vod_name: vod.video_name,
  156. vod_pic: vod.img,
  157. vod_remarks: vod.qingxidu,
  158. });
  159. }
  160. return JSON.stringify({
  161. page: page,
  162. list: videos,
  163. });
  164. }
  165. function getHeaders() {
  166. let t = new Date().getTime().toString();
  167. return {
  168. 'version_name': '1.0.6',
  169. 'version_code': '6',
  170. 'package_name': 'com.app.nanguatv',
  171. 'sign': Crypto.MD5('c431ea542cee9679#uBFszdEM0oL0JRn@' + t).toString().toUpperCase(),
  172. 'imei': 'c431ea542cee9679',
  173. 'timeMillis': t,
  174. 'User-Agent': 'okhttp/4.6.0'
  175. };
  176. }
  177. export function __jsEvalReturn() {
  178. return {
  179. init: init,
  180. home: home,
  181. homeVod: homeVod,
  182. category: category,
  183. detail: detail,
  184. play: play,
  185. search: search,
  186. };
  187. }