Ng_open.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import {
  2. Crypto, load, _
  3. }
  4. from 'assets://js/lib/cat.js';
  5. let key = '影视大全';
  6. let deviceInfo = "app=ylys&devices=android&imei=&deviceModel=PCLM10&deviceVersion=9&appVersionName=1.0.9&deviceScreen=1920*1080&appVersionCode=9&deviceBrand=OPPO";
  7. let siteKey = '';
  8. let siteType = 0;
  9. 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';
  10. async function request(reqUrl) {
  11. let time = Math.round(new Date().getTime()/1000).toString();
  12. let sign = Crypto.MD5("#uBFszdEM0oL0JRn@" + time).toString()
  13. let res = await req(reqUrl, {
  14. method: 'get',
  15. headers: {
  16. 'User-Agent': 'okhttp/4.6.0',
  17. 'package_name': 'com.app.nanguatv',
  18. 'version_code':'9',
  19. 'version_name':'1.0.9',
  20. 'timeMillis':time,
  21. 'sign':sign,
  22. },
  23. });
  24. return res.content;
  25. }
  26. // cfg = {skey: siteKey, ext: extend}
  27. async function init(cfg) {
  28. siteKey = cfg.skey;
  29. siteType = cfg.stype;
  30. }
  31. async function home(filter) {
  32. let filterObj = [];
  33. let time = Math.round(new Date().getTime()/1000).toString();
  34. let api = "http://ys.changmengyun.com/api.php/provide/home_nav?time="+time+"&"+deviceInfo;
  35. const resp = await request(api);
  36. const navs = JSON.parse(resp);
  37. const classes = _.map(navs,(item) => {
  38. let typeId = item.id;
  39. if( 0 === typeId) return {};
  40. let typeName = item.name;
  41. return {
  42. type_id: typeId,
  43. type_name: typeName
  44. };
  45. });
  46. return JSON.stringify({
  47. class: classes,
  48. filters: filterObj,
  49. });
  50. }
  51. async function homeVod() {}
  52. async function category(tid, pg, filter, extend) {
  53. let time = Math.round(new Date().getTime()/1000).toString();
  54. const link = "http://ys.changmengyun.com/api.php/provide/vod_list?time="+time+"&id="+tid+"&page="+pg+"&"+deviceInfo;
  55. const resp = await request(link);
  56. const items = JSON.parse(resp);
  57. let videos = _.map(items.list, (item) => {
  58. return {
  59. vod_id: item.id,
  60. vod_name: item.name,
  61. vod_pic: item.img,
  62. vod_remarks: item.msg,
  63. };
  64. });
  65. return JSON.stringify({
  66. page: parseInt(pg),
  67. pagecount: 0,
  68. limit: 0,
  69. total: 0,
  70. list: videos,
  71. });
  72. }
  73. async function detail(id) {
  74. let time = Math.round(new Date().getTime()/1000).toString();
  75. const link = "http://ys.changmengyun.com/api.php/provide/vod_detail?time="+time+"&id="+id+"&"+deviceInfo;
  76. const resp = await request(link);
  77. const item = JSON.parse(resp).data;
  78. const vod = {
  79. vod_id: id,
  80. vod_name: item.name,
  81. vod_pic: item.img,
  82. vod_remarks: item.msg,
  83. vod_content: '[关注公众号:影视资源站] ' + item.info,
  84. };
  85. const playMap = {};
  86. const tabs = item.player_info;
  87. _.each(tabs, (tab, i) => {
  88. const from = tab.show || tab.from;
  89. let list = tab.video_info;
  90. _.each(list, (it) => {
  91. const title = it.name;
  92. const playUrl = it.url;
  93. if (!playMap.hasOwnProperty(from)) {
  94. playMap[from] = [];
  95. }
  96. playMap[from].push(title + '$' + playUrl);
  97. });
  98. });
  99. vod.vod_play_from = _.keys(playMap).join('$$$');
  100. const urls = _.values(playMap);
  101. const vod_play_url = _.map(urls, (urlist) => {
  102. return urlist.join('#');
  103. });
  104. vod.vod_play_url = vod_play_url.join('$$$');
  105. return JSON.stringify({
  106. list: [vod],
  107. });
  108. }
  109. async function play(flag, id, flags) {
  110. const links = id.split(',');
  111. let playurl = '', ua = '';
  112. for(const link of links) {
  113. try{
  114. let resp = await request(link);
  115. let js = JSON.parse(resp);
  116. playurl = js.hasOwnProperty('data') ? js.data.url : js.url;
  117. ua = js.data.header['User-Agent'];
  118. if (playurl.length > 10) break;
  119. }catch(e){
  120. console.debug("err " + e);
  121. }
  122. }
  123. return JSON.stringify({
  124. parse: 0,
  125. url: playurl,
  126. header: {
  127. 'User-Agent': ua || UA,
  128. },
  129. });
  130. }
  131. async function search(wd, quick) {
  132. let time = Math.round(new Date().getTime()/1000).toString();
  133. const link = "http://ys.changmengyun.com/api.php/provide/search_result?video_name="+ key +"&time="+time+"&"+deviceInfo;
  134. let data = JSON.parse(await request(link)).data;
  135. let videos = [];
  136. for (const typeData of data) {
  137. for(const vod of typeData.data) {
  138. videos.push({
  139. vod_id: vod.id,
  140. vod_name: vod.video_name,
  141. vod_pic: vod.img,
  142. vod_remarks: vod.qingxidu,
  143. });
  144. }
  145. }
  146. return JSON.stringify({
  147. list: videos,
  148. });
  149. }
  150. export function __jsEvalReturn() {
  151. return {
  152. init: init,
  153. home: home,
  154. homeVod: homeVod,
  155. category: category,
  156. detail: detail,
  157. play: play,
  158. search: search,
  159. };
  160. }