nongmin_open.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. //let siteUrl = 'https://m.xiangdao.me';
  3. //let siteUrl ='https://v.nmvod.cn';
  4. let siteUrl = 'https://wwgz.cn';
  5. let siteKey = '';
  6. let siteType = 0;
  7. let headers = {
  8. //'User-Agent': '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',
  9. 'Referer': siteUrl + '/'
  10. };
  11. let PARSE_URL = 'https://api.cnmcom.com/webcloud/relay.php';
  12. let jxUrl = ['https://api.cnmcom.com/webcloud/nma.php?url=','https://api.cnmcom.com/webcloud/nmb.php?url=', 'https://api.cnmcom.com/webcloud/nmc.php?vid=', 'https://api.cnmcom.com/webcloud/m3u8.php?url='];
  13. async function request(reqUrl, postData, post) {
  14. let res = await req(reqUrl, {
  15. method: post ? 'post' : 'get',
  16. headers: headers,
  17. data: postData || {},
  18. postType: post ? 'form' : '',
  19. });
  20. let content = res.content;
  21. return content;
  22. }
  23. async function init(cfg) {
  24. siteKey = cfg.skey;
  25. siteType = cfg.stype;
  26. if (cfg.ext) {
  27. siteUrl = cfg.ext;
  28. }
  29. const html = (await req(PARSE_URL, {
  30. method: 'get',
  31. headers: {
  32. 'User-Agent': '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',
  33. 'Referer': siteUrl + '/',
  34. }
  35. })).content;
  36. //console.log('html', html);
  37. const url = html.match(/src = '(.*?)' \+ videoUrl;/);
  38. jxUrl[0] = url[1];
  39. }
  40. async function home(filter) {
  41. let classes = [{
  42. type_id: '1',
  43. type_name: '电影',
  44. },{
  45. type_id: '2',
  46. type_name: '剧集',
  47. },{
  48. type_id: '3',
  49. type_name: '综艺',
  50. },{
  51. type_id: '4',
  52. type_name: '动漫',
  53. },{
  54. type_id: '26',
  55. type_name: '短剧',
  56. }];
  57. let filterObj = genFilterObj();
  58. return JSON.stringify({
  59. class: classes,
  60. filters: filterObj
  61. });
  62. }
  63. async function homeVod() {
  64. let url = siteUrl;
  65. let videos = await getRecommend(url);
  66. return JSON.stringify({
  67. list: videos,
  68. });
  69. }
  70. async function category(tid, pg, filter, ext) {
  71. if (!pg) pg = 1;
  72. if (pg <= 0) pg = 1;
  73. let id = ext['id'] || tid;
  74. let year = ext['year'] || '';
  75. let area = ext['area'] || '';
  76. let url = siteUrl + '/index.php?m=vod-list-id-'+id+'-pg-'+pg+'-order--by-time-class-0-year-'+year+'-letter--area-'+area+'-lang-.html';
  77. let videos = await getVideos(url);
  78. return JSON.stringify({
  79. list: videos,
  80. page: pg,
  81. });
  82. }
  83. async function detail(id) {
  84. try {
  85. const html = await request(siteUrl + id);
  86. let $ = load(html);
  87. let content = $('.jjie').text();
  88. let director = _.map($('.d_z_y:eq(0) font a'), (n) => {
  89. return $(n).text();
  90. }).join(' ');
  91. let actor = _.map($('.d_z_y:eq(1) font a'), (n) => {
  92. return $(n).text();
  93. }).join(' ');
  94. let play1Url = siteUrl + $('.soyurl ul li a').attr('href');
  95. $ = load(await request(play1Url));
  96. let nameUrls = $('div.player > script:nth-child(1)').text().split("mac_url='")[1].split("';")[0];
  97. let playUrls = [];
  98. let playFroms = [];
  99. if($('div.hd > ul > li > a').text().indexOf('云播') >= 0) {
  100. playFroms.push('云播');
  101. playUrls.push(nameUrls.replaceAll('$', '$' + jxUrl[3]));
  102. } else {
  103. playFroms.push('Leospring');
  104. playUrls.push(nameUrls.replaceAll('$', '$'+jxUrl[0]));
  105. }
  106. const video = {
  107. vod_play_from: playFroms.join('$$$'),
  108. vod_play_url: playUrls.join('$$$'),
  109. vod_content: content,
  110. vod_director: director,
  111. vod_actor: actor,
  112. };
  113. const list = [video];
  114. const result = { list };
  115. return JSON.stringify(result);
  116. } catch (e) {
  117. console.log('err', e);
  118. }
  119. return null;
  120. }
  121. async function search(wd, quick, pg) {
  122. let url = siteUrl + '/index.php?m=vod-search';
  123. const html = await request(url, {wd: wd}, true);
  124. const $ = load(html);
  125. const cards = $('ul.list_01 li')
  126. let videos = _.map(cards, (n) => {
  127. let id = $($(n).find('a')[0]).attr('href');
  128. let name = $($(n).find('a')[0]).attr('title');
  129. let pic = $($(n).find('img')[0]).attr('src');
  130. let remarks = $($(n).find('font')[0]).text().trim();
  131. return {
  132. vod_id: id,
  133. vod_name: name,
  134. vod_pic: pic,
  135. vod_remarks: remarks,
  136. };
  137. });
  138. return JSON.stringify({
  139. list: videos,
  140. });
  141. }
  142. async function play(flag, id, flags) {
  143. let playUrl = id;
  144. const html = (await req(playUrl, {
  145. method: 'get',
  146. headers: {
  147. 'User-Agent': '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',
  148. 'Referer': PARSE_URL + '?',
  149. }
  150. })).content;
  151. //const html = await request(playUrl);
  152. const $ = load(html);
  153. for(const n of $('script')) {
  154. if($(n).text().indexOf("url: '") >= 0) {
  155. let url = $(n).text().split("url: '")[1].split("'")[0];
  156. if(url) {
  157. playUrl = url;
  158. }
  159. return JSON.stringify({
  160. parse: 0,
  161. url: playUrl,
  162. });
  163. }
  164. if($(n).text().indexOf("var url='") >= 0) {
  165. let url = $(n).text().split("var url='")[1].split("';")[0];
  166. if(url) {
  167. playUrl = url;
  168. }
  169. return JSON.stringify({
  170. parse: 0,
  171. url: playUrl,
  172. });
  173. }
  174. }
  175. return JSON.stringify({
  176. parse: 1,
  177. url: playUrl,
  178. });
  179. }
  180. function genFilterObj() {
  181. return {
  182. '1': [{'key': 'id', 'name': '类型', 'value': [{'n': '全部类型', 'v': '1'}, {'n': '动作', 'v': '5'}, {'n': '喜剧', 'v': '6'}, {'n': '爱情', 'v': '7'}, {'n': '科幻', 'v': '8'}, {'n': '恐怖', 'v': '9'}, {'n': '剧情', 'v': '10'}, {'n': '战争', 'v': '11'},{'n': '惊悚', 'v': '16'},{'n': '奇幻', 'v': '17'}]},
  183. {'key': 'area', 'name': '地区', 'value': [{'n': '全部地区', 'v': ''}, {'n': '大陆', 'v': '大陆'}, {'n': '香港', 'v': '香港'}, {'n': '台湾', 'v': '台湾'}, {'n': '美国', 'v': '美国'}, {'n': '韩国', 'v': '韩国'},{'n': '日本', 'v': '日本'}]},
  184. {'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': '2014', 'v': '2014'}, {'n': '2013', 'v': '2013'}, {'n': '2012', 'v': '2012'}, {'n': '2011', 'v': '2011'}, {'n': '2010', 'v': '2010'}]}
  185. ],
  186. '2': [{'key': 'id', 'name': '类型', 'value': [{'n': '全部类型', 'v': '2'}, {'n': '国产剧', 'v': '12'}, {'n': '港台剧', 'v': '13'},{'n': '日韩剧', 'v': '14'}, {'n': '欧美剧', 'v': '15'}]},
  187. {'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': '其他'}]},
  188. {'key': 'year', 'name': '年份', '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'}, {'n': '2009', 'v': '2009'}, {'n': '2008', 'v': '2008'}, {'n': '2006', 'v': '2006'}, {'n': '2005', 'v': '2005'}]}
  189. ]
  190. };
  191. }
  192. async function getRecommend(url) {
  193. const html = await request(url);
  194. const $ = load(html);
  195. const cards = $('ul.list_06 li')
  196. let videos = _.map(cards, (n) => {
  197. let id = $($(n).find('a')[0]).attr('href');
  198. let name = $($(n).find('a')[0]).attr('title');
  199. let pic = $($(n).find('img')[0]).attr('src');
  200. let remarks = $($(n).find('font')[0]).text().trim().replaceAll('0.0', '');
  201. return {
  202. vod_id: id,
  203. vod_name: name,
  204. vod_pic: pic,
  205. vod_remarks: remarks,
  206. };
  207. });
  208. return videos;
  209. }
  210. async function getVideos(url) {
  211. const html = await request(url);
  212. const $ = load(html);
  213. const cards = $('ul.list_01 li')
  214. let videos = _.map(cards, (n) => {
  215. let id = $($(n).find('a')[0]).attr('href');
  216. let name = $($(n).find('a')[0]).attr('title');
  217. let pic = $($(n).find('img')[0]).attr('src');
  218. let remarks = $($(n).find('font')[0]).text().trim();
  219. return {
  220. vod_id: id,
  221. vod_name: name,
  222. vod_pic: pic,
  223. vod_remarks: remarks,
  224. };
  225. });
  226. return videos;
  227. }
  228. export function __jsEvalReturn() {
  229. return {
  230. init: init,
  231. home: home,
  232. homeVod: homeVod,
  233. category: category,
  234. detail: detail,
  235. play: play,
  236. search: search,
  237. };
  238. }