kkpans.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. var rule = {
  2. title:'KK網盤[磁]',
  3. host:'https://www.kkpans.com',
  4. homeUrl:'/',
  5. url: '/forum-fyclass-fypage.html?',
  6. //host:'http://192.168.101.1:10078',
  7. //homeUrl:'/p/0/s/https://www.kkpans.com/',
  8. //url: '/p/0/s/https://www.kkpans.com/forum-fyclass-fypage.html?',
  9. filter_url:'{{fl.class}}',
  10. filter:{
  11. },
  12. searchUrl: '/search',
  13. searchable:2,
  14. quickSearch:0,
  15. filterable:0,
  16. headers:{
  17. 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; SM-G981B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Mobile Safari/537.36',
  18. 'Accept': '*/*',
  19. 'Referer': 'https://www.kkpans.com/'
  20. },
  21. timeout:5000,
  22. class_name:'国外电影&国外电视剧&纪录片资源&综艺资源&动漫资源&音乐资源',
  23. class_url:'39&40&41&42&46&43',
  24. play_parse:true,
  25. play_json:[{
  26. re:'*',
  27. json:{
  28. parse:0,
  29. jx:0
  30. }
  31. }],
  32. lazy:'',
  33. limit:6,
  34. 推荐:'',
  35. 一级:`js:
  36. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  37. let d = [];
  38. log("kkpans input>>>>>>>>>>>>>>"+input);
  39. let html = request(input);
  40. //log("kkpans 1level html>>>>>>>>>>>>>>"+html);
  41. let list = pdfa(html, 'div.threadlist ul li.list');
  42. list.forEach(function(it) {
  43. d.push({
  44. title: pdfh(it, 'div.threadlist_tit&&Text'),
  45. desc: pdfh(it, 'div.threadlist_top div:has(>h3) span&&Text'),
  46. pic_url: '',
  47. url: pd(it, 'li.list&&a[href^="forum.php"]:eq(1)&&href', HOST)
  48. });
  49. })
  50. setResult(d);
  51. `,
  52. 二级:{
  53. title:"div.viewthread&&div.view_tit&&Text",
  54. img:"div.viewthread div.message&&img&&src",
  55. desc:"div.viewthread div.message&&Text",
  56. content:"div.viewthread div.message&&Text",
  57. tabs:`js:
  58. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  59. TABS=[]
  60. let d = pdfa(html, 'div.viewthread div.message a[href^="https://pan.quark.cn/s/"]');
  61. let index = 1;
  62. if (false && d.length>1){
  63. TABS.push("選擇右側綫路");
  64. }
  65. d.forEach(function(it) {
  66. TABS.push("夸克網盤" + index);
  67. index = index + 1;
  68. });
  69. log('meijumi TABS >>>>>>>>>>>>>>>>>>' + TABS);
  70. `,
  71. lists:`js:
  72. log(TABS);
  73. LISTS=[];
  74. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  75. let d = pdfa(html, 'div.viewthread div.message a[href^="https://pan.quark.cn/s/"]');
  76. let index = 1;
  77. if (false && d.length>1){
  78. LISTS.push(["選擇右側綫路,或3秒後自動跳過$http://127.0.0.1:10079/delay/"]);
  79. }
  80. d.forEach(function(it) {
  81. let burl = pdfh(it, 'a&&href');
  82. if (true){
  83. if (d.length==1){
  84. burl = "http://127.0.0.1:9978/proxy?do=quark&type=push&confirm=0&url=" + encodeURIComponent(burl);
  85. }else{
  86. burl = "http://127.0.0.1:9978/proxy?do=quark&type=push&url=" + encodeURIComponent(burl);
  87. }
  88. }else{
  89. burl = "push://" + burl;
  90. }
  91. let title = pdfh(it, 'a&&Text');
  92. LISTS.push([title + '$' + burl]);
  93. });
  94. `,
  95. },
  96. 搜索:`js:
  97. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  98. let withHeaders = {
  99. withHeaders: true
  100. };
  101. let _fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
  102. Object.assign(_fetch_params, withHeaders);
  103. let new_html=request(rule.homeUrl + 'search.php?mod=forum', _fetch_params);
  104. log('kkpans search new_html >>>>>>>>>>>>>>>>>>>>>' + new_html);
  105. let json=JSON.parse(new_html);
  106. let setCk=Object.keys(json).find(it=>it.toLowerCase()==="set-cookie");
  107. let cookie="";
  108. if (typeof setCk !== "undefined"){
  109. let d=[];
  110. for(const key in json[setCk]){
  111. if (typeof json[setCk][key] === "string"){
  112. log("kkpans header setCk key>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + json[setCk][key] + " " + (typeof json[setCk][key]));
  113. d.push(json[setCk][key].split(";")[0]);
  114. }
  115. }
  116. cookie=d.join(";");
  117. }
  118. fetch_params.headers.Cookie=cookie;
  119. rule_fetch_params.headers.Cookie=cookie;
  120. log('kkpans search cookie >>>>>>>>>>>>>>>>>>>>>' + cookie);
  121. //log('kkpans search body >>>>>>>>>>>>>>>>>>>>>' + json['body']);
  122. new_html = json['body'];
  123. let formhash = pdfh(new_html, 'input[name="formhash"]&&value');
  124. log("kkpans formhash>>>>>>>>>>>>>>>" + formhash);
  125. let params = 'formhash=' + formhash + '&searchsubmit=yes&srchtxt=' + encodeURIComponent(KEY);
  126. _fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
  127. let postData = {
  128. body: params
  129. };
  130. Object.assign(_fetch_params, postData);
  131. log("kkpans search postData>>>>>>>>>>>>>>>" + JSON.stringify(_fetch_params));
  132. let search_html = post(rule.homeUrl + 'search.php?mod=forum', _fetch_params)
  133. //log("kkpans search result>>>>>>>>>>>>>>>" + search_html);
  134. let d=[];
  135. let dlist = pdfa(search_html, 'div.threadlist ul li.list');
  136. dlist.forEach(function(it){
  137. let title = pdfh(it, 'div.threadlist_tit&&Text');
  138. if (searchObj.quick === true){
  139. if (title.includes(KEY)){
  140. title = KEY;
  141. }
  142. }
  143. let img = "";
  144. let content = pdfh(it, 'div.threadlist_top div:has(>h3) span&&Text');
  145. let desc = pdfh(it, 'div.threadlist_top div:has(>h3) span&&Text');
  146. let url = pd(it, 'a[href^="forum.php?mod=viewthread"]&&href', HOST);
  147. d.push({
  148. title:title,
  149. img:img,
  150. content:content,
  151. desc:desc,
  152. url:url
  153. })
  154. });
  155. setResult(d);
  156. `,
  157. }