JOJO.js 6.7 KB

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