pansearch.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. var rule = {
  2. title:'盘搜搜索',
  3. host:'https://www.pansearch.me/',
  4. homeUrl:'/',
  5. url: '/forum-fyclass-fypage.html?',
  6. filter_url:'{{fl.class}}',
  7. filter:{
  8. },
  9. searchUrl: '/search?keyword=**',
  10. searchable:2,
  11. quickSearch:0,
  12. filterable:0,
  13. headers:{
  14. 'User-Agent': PC_UA,
  15. 'Accept': '*/*',
  16. 'Referer': 'https://www.pansearch.me'
  17. },
  18. timeout:5000,
  19. play_parse:true,
  20. lazy:`js:
  21. input = panPlay(input,playObj.flag)
  22. `,
  23. limit:6,
  24. 推荐:'',
  25. 一级:'',
  26. 二级:`js:
  27. let id=input;
  28. let title="";
  29. let pic="";
  30. let typeName="";
  31. let dec=id;
  32. let remark="";
  33. let vod={vod_id:id,vod_name:title,vod_pic:pic,type_name:typeName,vod_remarks:remark,vod_content:dec};
  34. initPan();
  35. let panVod = panDetailContent(vod ,[input]);
  36. TABS = panVod.tabs
  37. LISTS = panVod.lists
  38. detailError = panVod.error
  39. vod["vod_play_from"]=panVod.tabs.join("$$$");
  40. for (var i in LISTS) {
  41. if (LISTS.hasOwnProperty(i)) {
  42. // print(i);
  43. try {
  44. LISTS[i] = LISTS[i].map(function (it) {
  45. return it.split('$').slice(0, 2).join('$');
  46. });
  47. } catch (e) {
  48. print('格式化LISTS发生错误:' + e.message);
  49. }
  50. }
  51. }
  52. vod_play_url = LISTS.map(function (it) {
  53. return it.join('#');
  54. }).join("$$$");
  55. vod["vod_play_url"]=vod_play_url;
  56. VOD=vod;
  57. `,
  58. 搜索:`js:
  59. var buildId = "";
  60. function getBuildId(){
  61. const html = request(rule.homeUrl);
  62. const regex = /"buildId":"(.*?)"/;
  63. const match = regex.exec(html);
  64. if (match && match.length > 1) {
  65. buildId = match[1];
  66. }
  67. }
  68. function get_result(){
  69. const limit = 10;
  70. let offsetParam = '';
  71. const offset = (MY_PAGE - 1) * limit;
  72. if (offset > 0) {
  73. offsetParam = '&offset=' + offset;
  74. }
  75. const urls = rule.homeUrl + "_next/data/" + buildId + "/search.json?keyword=" + encodeURIComponent(KEY) + offsetParam;
  76. const result = JSON.parse(request(urls));
  77. const json = result.pageProps.data;
  78. const total = json.total;
  79. const videoIdSet = new Set();
  80. const videos = [];
  81. for (const item of json.data) {
  82. const content = item.content;
  83. let splitList = content.split('\\n');
  84. const img = item.image || (rule.homeUrl + "favicon.png");
  85. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  86. if (content.includes('1、')) {
  87. for (const line of splitList) {
  88. if (line === "") continue;
  89. let vodId = pdfh(line, 'a&&href');
  90. if (!vodId) continue;
  91. if (!vodId.includes('alipan.com') && !vodId.includes('quark.cn') && !vodId.includes('aliyundrive.com')) continue;
  92. videos.push({
  93. vod_id: vodId,
  94. vod_name: line.replaceAll(/<\\/?[^>]+>/g, "").replace(/[0-9]*、/g, '').replace(/:http.*/g, ''),
  95. vod_pic: img,
  96. vod_remarks: item.pan,
  97. });
  98. }
  99. } else {
  100. let vodId = pdfh(content, 'a&&href');
  101. const vodName = splitList[0].replaceAll(/<\\\\?[^>]+>/g, "").replace("名称:", "").replace("资源标题:", "");
  102. if (!vodId) continue;
  103. videos.push({
  104. vod_id: vodId,
  105. vod_name: vodName,
  106. vod_pic: img,
  107. vod_remarks: item.pan,
  108. });
  109. }
  110. }
  111. return videos;
  112. }
  113. if (!buildId.length) {
  114. getBuildId()
  115. }
  116. VODS = get_result();
  117. `,
  118. }