JOJO.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. let root = 'https://jiohub.top';
  2. let header = {
  3. 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
  4. 'Referer': 'https://jiohub.top'
  5. };
  6. const wpurl = 'about:jojo';
  7. const wpHtml = `
  8. <script src="https://gcore.jsdelivr.net/gh/msterzhang/cdn@1.0.35/jojo/dist/js/wasm_exec_tiny.js"></script>
  9. <script>
  10. const go = new Go();
  11. WebAssembly.instantiateStreaming(fetch('https:\/\/gcore.jsdelivr.net\/gh\/msterzhang\/cdn@1.0.35\/jojo\/dist/js/pid.wasm'), go.importObject).then((result) => {
  12. go.run(result.instance);
  13. });
  14. </script>
  15. <div style="display: none;" id="jojo">jojo</div>
  16. `;
  17. async function init(ext) {
  18. if (ext.indexOf('http') == 0) {
  19. root = ext;
  20. }
  21. }
  22. async function home(filter) {
  23. const purl = getAddress(true) + 'webparse/' + wpurl + '<<eval:"ok"?load=html&&init=1';
  24. console.log(purl);
  25. const res = await req(purl, {
  26. method: 'POST',
  27. data: wpHtml,
  28. postType: 'text'
  29. });
  30. console.log("loadWebHtml: " + res.content);
  31. const cate = "电影#国产#美剧#韩剧#日剧#动漫#纪录";
  32. const cateFilter = "动作#爱情#剧情#科幻#恐怖#动画#喜剧#犯罪";
  33. let classes = [];
  34. let filters = {};
  35. const value = [{n:"全部", v:""}];
  36. for (const v of cateFilter.split('#')) {
  37. value.push({n: v, v: v});
  38. }
  39. const f = {
  40. key: 'label',
  41. name: '标签',
  42. value: value
  43. };
  44. for (const item of cate.split('#')) {
  45. classes.push({
  46. 'type_id': item,
  47. 'type_name': item
  48. });
  49. filters[item] = f;
  50. }
  51. // console.log(JSON.stringify(classes));
  52. return JSON.stringify({
  53. 'class': classes,
  54. 'filters': filters ? filters : null
  55. });
  56. }
  57. async function homeVod(params) {
  58. let videos = [];
  59. const url = `${root}/video/国产?page=1&size=51`;
  60. let res = await req(url, {
  61. headers: header,
  62. method: 'GET'
  63. });
  64. const html = res.content;
  65. const data = html.match(/<a href="\/watch\/[\s\S]+?<\/a>/g);
  66. if (data) {
  67. for (const v of data) {
  68. const video = {
  69. 'vod_id': v.match(/href="(.+?)"/)[1],
  70. 'vod_name': v.match(/<p class="card-title">(.+?)<\/p>/)[1],
  71. 'vod_pic': v.match(/src="(.+?)"/)[1],
  72. 'vod_remarks': v.match(/<p class="item-speed">(.+?)<\/p>/)[1] + ' ' + v.match(/<p class="score">(.+?)<\/p>/)[1]
  73. };
  74. videos.push(video);
  75. }
  76. }
  77. return JSON.stringify({
  78. 'list': videos,
  79. 'type_des': ''
  80. });
  81. }
  82. async function category(tid, page, filter, extend) {
  83. let videos = [];
  84. if (page < 1) page = 1;
  85. const label = (extend.label && extend.label!='' ? '/' + extend.label : '');
  86. const url = `${root}/video/${tid}${label}?page=${page}&size=18`;
  87. console.log(url);
  88. let res = await req(url, {
  89. headers: header,
  90. method: 'GET'
  91. });
  92. const html = res.content;
  93. const data = html.match(/<a href="\/watch\/[\s\S]+?<\/a>/g);
  94. if (data) {
  95. for (const v of data) {
  96. const video = {
  97. 'vod_id': v.match(/href="(.+?)"/)[1],
  98. 'vod_name': v.match(/<p class="card-title">(.+?)<\/p>/)[1],
  99. 'vod_pic': v.match(/src="(.+?)"/)[1],
  100. 'vod_remarks': v.match(/<p class="item-speed">(.+?)<\/p>/)[1] + ' ' + v.match(/<p class="score">(.+?)<\/p>/)[1]
  101. };
  102. videos.push(video);
  103. }
  104. }
  105. // console.log(JSON.stringify(videos));
  106. return JSON.stringify({
  107. 'page': page,
  108. 'pagecount': page + 1,
  109. 'limit': videos.length,
  110. 'total': videos.length * (page + 1),
  111. 'list': videos,
  112. 'type_des': ''
  113. });
  114. }
  115. async function detail(tid) {
  116. const url = root + tid;
  117. console.log(url);
  118. let res = await req(url, {
  119. headers: header,
  120. method: 'GET'
  121. });
  122. let html = res.content;
  123. const div = html.match(/<div class="content-detail">([\s\S]+?)<\/div>/)[1];
  124. const vod = {
  125. "vod_id": tid,
  126. "vod_name": div.match(/<h3.*?>(.+?)<\/h3>/)[1],
  127. "vod_pic": '',
  128. "type_name": div.match(/<p class="data">类型:(.+?)<\/p>/)[1],
  129. "vod_year": div.match(/<p class="data">年份:(.+?)<\/p>/)[1],
  130. "vod_area": '',
  131. "vod_remarks": '',
  132. "vod_actor": div.match(/<p class="data">主演:(.+?)<\/p>/)[1],
  133. "vod_director": div.match(/<p class="data">导演:(.+?)<\/p>/)[1],
  134. "vod_content": div.match(/class="detail-sketch hide">([\s\S]+?)<\/span>/)[1],
  135. "vod_play_from": 'JOJO',
  136. "vod_play_url": ''
  137. };
  138. const urls = html.match(/let urls = "(.+?)"/)[1];
  139. // console.log(urls);
  140. const purl = getAddress(true) + 'webparse/' + wpurl + '<<eval:getData(tvbox.getPostBody())';
  141. console.log(purl);
  142. res = await req(purl, {
  143. headers: header,
  144. method: 'POST',
  145. data: urls,
  146. postType: 'text'
  147. });
  148. // console.log(res.content);
  149. vod.vod_play_url = res.content.replaceAll(/\n/g, "#");
  150. // console.log(JSON.stringify(vod));
  151. return JSON.stringify({
  152. 'list': [vod]
  153. });
  154. }
  155. async function play(flag, id, flags) {
  156. const purl = getAddress(true) + 'webparse/' + wpurl + '<<eval:getPid()';
  157. const res = await req(purl, {
  158. headers: header,
  159. method: 'GET'
  160. });
  161. return JSON.stringify({
  162. parse: 0,
  163. url: id + '?pid=' + res.content,
  164. header: {"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"}
  165. });
  166. }
  167. async function search(wd, quick) {
  168. const purl = getAddress(true) + 'webparse/' + wpurl + '<<eval:getPid()';
  169. const pres = await req(purl, {
  170. headers: header,
  171. method: 'GET'
  172. });
  173. const url = root + '/video/search?q=' + encodeURIComponent(wd) + '&pid=' + pres.content;
  174. console.log(url);
  175. let videos = [];
  176. let res = await req(url, {
  177. headers: header,
  178. method: 'GET'
  179. });
  180. const html = res.content;
  181. const data = html.match(/<a href="\/watch\/[\s\S]+?<\/a>/g);
  182. if (data) {
  183. for (const v of data) {
  184. const video = {
  185. 'vod_id': v.match(/href="(.+?)"/)[1],
  186. 'vod_name': v.match(/<p class="card-title">(.+?)<\/p>/)[1],
  187. 'vod_pic': v.match(/src="(.+?)"/)[1],
  188. 'vod_remarks': v.match(/<p class="item-speed">(.+?)<\/p>/)[1] + ' ' + v.match(/<p class="score">(.+?)<\/p>/)[1]
  189. };
  190. videos.push(video);
  191. }
  192. }
  193. return JSON.stringify({
  194. 'list': videos,
  195. 'type_des': ''
  196. });
  197. }
  198. __JS_SPIDER__ = {
  199. init: init,
  200. home: home,
  201. homeVod: homeVod,
  202. category: category,
  203. detail: detail,
  204. play: play,
  205. search: search,
  206. extResult: null
  207. };