bdys10_open.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. import { Crypto, load, _, html } from 'assets://js/lib/cat.js';
  2. let siteUrl ='https://www.yjys01.com';
  3. let siteKey = '';
  4. let siteType = 0;
  5. let headers = {
  6. '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',
  7. 'Referer': siteUrl + '/'
  8. };
  9. async function request(reqUrl, postData, post) {
  10. let res = await req(reqUrl, {
  11. method: post ? 'post' : 'get',
  12. headers: headers,
  13. data: postData || {},
  14. postType: post ? 'form' : '',
  15. });
  16. let content = res.content;
  17. return content;
  18. }
  19. async function init(cfg) {
  20. siteKey = cfg.skey;
  21. siteType = cfg.stype;
  22. if (cfg.ext) {
  23. siteUrl = cfg.ext;
  24. }
  25. }
  26. async function home(filter) {
  27. let classes = [{
  28. type_id: '0',
  29. type_name: '电影',
  30. },{
  31. type_id: '1',
  32. type_name: '剧集'}];
  33. let filterObj = await genFilterObj();
  34. return JSON.stringify({
  35. class: classes,
  36. filters: filterObj
  37. });
  38. }
  39. async function homeVod() {
  40. }
  41. async function category(tid, pg, filter, ext) {
  42. if (!pg) pg = 1;
  43. if (pg <= 0) pg = 1;
  44. let type = ext['type'];
  45. let year = ext['year'];
  46. let area = ext['area'];
  47. let url = `${siteUrl}${type}/${pg}?type=${tid}`;
  48. if (area) {
  49. url = url + '&area=' + area;
  50. }
  51. if(year) {
  52. url = url + '&year=' + year;
  53. }
  54. let videos = await getVideos(url);
  55. return JSON.stringify({
  56. list: videos,
  57. page: pg,
  58. });
  59. }
  60. async function detail(id) {
  61. try {
  62. const html = await request(siteUrl + id);
  63. let $ = load(html);
  64. let content = $('#synopsis > div.card-body').text();
  65. let director = _.map($('div.col.mb-2 > p:nth-child(2) > a'), (n) => {
  66. return $(n).text();
  67. }).join(' ');
  68. let actor = _.map($('div.col.mb-2 > p:nth-child(4) > a'), (n) => {
  69. return $(n).text();
  70. }).join(' ');
  71. const playNameUrls = _.map($('#play-list > div > a'), item => {
  72. return $(item).text() + '$' + $(item).attr('href').split(';')[0];
  73. }).join('#');
  74. const downloadList = _.map($('#download-list > tr'), item => {
  75. return $($(item).find('td')[1]).text() + '$'+ $($(item).find('td:nth-child(3) > a')[0]).attr('href').split(';')[0];
  76. }).join('#');
  77. const torrentList = _.map($('#torrent-list > ul > li > div > div > a'), item => {
  78. return $(item).attr('download') + '$' + $(item).attr('href').split(';')[0];
  79. }).join('#');
  80. const video = {
  81. vod_play_from: '直链$$$磁力',
  82. vod_play_url: playNameUrls + '$$$' + downloadList,
  83. vod_content: content,
  84. vod_director: director,
  85. vod_actor: actor,
  86. };
  87. const list = [video];
  88. const result = { list };
  89. return JSON.stringify(result);
  90. } catch (e) {
  91. console.log('err', e);
  92. }
  93. return null;
  94. }
  95. async function search(wd, quick, pg) {
  96. // let url = siteUrl + '/index.php?m=vod-search';
  97. // const html = await request(url, {wd: wd}, true);
  98. // const $ = load(html);
  99. // let data = $('#data_list > li');
  100. // let videos = _.map(data, (n) => {
  101. // let id = $($(n).find('div.pic > a')[0]).attr('href');
  102. // let pic = $($(n).find('div.pic > a > img')[0]).attr('data-src');
  103. // let name = $($(n).find(' span.sTit')[0]).text();
  104. // return {
  105. // vod_id: id,
  106. // vod_name: name,
  107. // vod_pic: pic,
  108. // vod_remarks: '',
  109. // };
  110. // });
  111. // return JSON.stringify({
  112. // list: videos,
  113. // });
  114. }
  115. async function play(flag, id, flags) {
  116. if(id.endsWith('.torrent')) {
  117. return JSON.stringify({
  118. parse: 0,
  119. url: siteUrl + id,
  120. });
  121. }
  122. if(id.startsWith('ed2k://') || id.startsWith('magnet:')) {
  123. return JSON.stringify({
  124. parse: 0,
  125. url: id,
  126. });
  127. }
  128. let playUrl = siteUrl + id;
  129. const html = await request(playUrl);
  130. const $ = load(html);
  131. let pid='176078';
  132. for(const n of $('script')) {
  133. if($(n).text().indexOf("var pid = ") >= 0) {
  134. pid = $(n).text().split("var pid = ")[1].split(";")[0];
  135. }
  136. }
  137. //console.log('pid', pid);
  138. let dt = new Date().getTime();
  139. //dt = 1709977071948;
  140. //2ed1ccdea49c0fa7e1af0f8507378f0a
  141. //2ed1ccdea49c0fa7e1af0f8507378f0a
  142. let md5Data = Crypto.MD5(pid + '-' + dt).toString().toLowerCase();
  143. //console.log('md5', md5Data);
  144. let key = Crypto.enc.Utf8.parse(md5Data.substring(0, 16));
  145. //console.log('key', key);
  146. let encData = Crypto.AES.encrypt(pid + '-' + dt, key, {
  147. mode: Crypto.mode.ECB,
  148. padding: Crypto.pad.Pkcs7
  149. });
  150. //"+OvtZJce3mznh0+NjhWgl4Nv6KAPToTft1c01+nUYi4="
  151. //C0ERRC3eRyA5Q/LbZ6sGyv3K1vxT8EPOIXIqWk8XZEw=
  152. //console.log(encData + '');
  153. let sg = encData.ciphertext.toString(Crypto.enc.Hex).toUpperCase();
  154. //console.log('sg', sg);
  155. let url = `${siteUrl}/lines?t=${dt}&sg=${sg}&pid=${pid}`;
  156. //console.log('url', url);
  157. let res = await req(url, {
  158. method: 'get',
  159. headers: headers,
  160. })
  161. playUrl = JSON.parse(res.content).data.url3;
  162. //console.log('url', res.content);
  163. return JSON.stringify({
  164. parse: 0,
  165. url: playUrl,
  166. });
  167. return JSON.stringify({
  168. parse: 1,
  169. url: playUrl,
  170. });
  171. }
  172. function base64Decode(text) {
  173. return Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(text));
  174. }
  175. async function genFilterObj() {
  176. const url = siteUrl + '/s/all';
  177. const html = await request(url);
  178. const $ = load(html);
  179. let types = _.map($('dl:nth-child(2) > dd > a'), item => {
  180. return {
  181. 'v': $(item).attr('href').split(';')[0],
  182. 'n': $(item).text(),
  183. }
  184. });
  185. let areas = _.map($('dl:nth-child(3) > dd > a'), item => {
  186. return {
  187. 'n': $(item).text(),
  188. 'v': $(item).text().replace('不限',''),
  189. }
  190. });
  191. let years = _.map($('dl:nth-child(4) > dd > a'), item => {
  192. return {
  193. 'n': $(item).text(),
  194. 'v': $(item).text().replace('不限',''),
  195. }
  196. });
  197. return {
  198. '0': [{'key': 'type', 'name': '类型', 'init': '/s/all','value': types},
  199. {'key': 'area', 'name': '地区', 'value': areas},
  200. {'key': 'year', 'name': '年份', 'value': years}
  201. ],
  202. '1': [{'key': 'type', 'name': '类型', 'init': '/s/all', 'value': types},
  203. {'key': 'area', 'name': '地区', 'value': areas},
  204. {'key': 'year', 'name': '年份', 'value': years}
  205. ],
  206. };
  207. }
  208. async function getVideos(url) {
  209. const html = await request(url);
  210. const $ = load(html);
  211. const cards = $('div.card.card-sm.card-link')
  212. let videos = _.map(cards, (n) => {
  213. let id = $($(n).find('a')[0]).attr('href').split(';')[0];
  214. let name = $($(n).find('h3')[0]).text();
  215. let pic = $($(n).find('img')[0]).attr('src');
  216. let remarks = $($(n).find('span')[0]).text().trim();
  217. return {
  218. vod_id: id,
  219. vod_name: name,
  220. vod_pic: pic,
  221. vod_remarks: remarks,
  222. };
  223. });
  224. return videos;
  225. }
  226. export function __jsEvalReturn() {
  227. return {
  228. init: init,
  229. home: home,
  230. homeVod: homeVod,
  231. category: category,
  232. detail: detail,
  233. play: play,
  234. search: search,
  235. };
  236. }