4khdr.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. var rule = {
  2. title:'4KHDR[磁]',
  3. host:'https://www.4khdr.cn',
  4. homeUrl: "/forum.php?mod=forumdisplay&fid=2&page=1",
  5. url: '/forum.php?mod=forumdisplay&fid=2&filter=typeid&typeid=fyclass&page=fypage',
  6. filter_url:'{{fl.class}}',
  7. filter:{
  8. },
  9. searchUrl: '/search.php#searchsubmit=yes&srchtxt=**;post',
  10. searchable:2,
  11. quickSearch:1,
  12. filterable:0,
  13. headers:{
  14. 'User-Agent': 'PC_UA',
  15. 'Cookie':'http://127.0.0.1:9978/file:///tvbox/JS/lib/4khdr.txt',
  16. },
  17. timeout:5000,
  18. class_name: "4K电影&4K美剧&4K华语&4K动画&4K纪录片&4K日韩印&蓝光电影&蓝光美剧&蓝光华语&蓝光动画&蓝光日韩印",
  19. class_url:"3&8&15&6&11&4&29&31&33&32&34",
  20. play_parse:true,
  21. play_json:[{
  22. re:'*',
  23. json:{
  24. parse:0,
  25. jx:0
  26. }
  27. }],
  28. lazy:'',
  29. limit:6,
  30. 推荐:'ul#waterfall li;a&&title;img&&src;div.auth.cl&&Text;a&&href',
  31. 一级:'ul#waterfall li;a&&title;img&&src;div.auth.cl&&Text;a&&href',
  32. 二级:{
  33. title:"#thead_subject&&Text",
  34. img:"img.zoom&&src",
  35. desc:'td[id^="postmessage_"] font&&Text',
  36. content:'td[id^="postmessage_"] font&&Text',
  37. tabs:`js:
  38. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  39. TABS=[]
  40. // log("4khdr 二级 html>>>>>>>>>>" + html);
  41. var d = pdfa(html, 'table.t_table');
  42. let magnetIndex=1;
  43. let aliIndex=1;
  44. d.forEach(function(it) {
  45. let burl = pdfh(it, 'a&&href');
  46. log("burl >>>>>>" + burl);
  47. if (burl.startsWith("https://www.aliyundrive.com/s/")){
  48. let result = 'aliyun' + aliIndex;
  49. aliIndex = aliIndex + 1;
  50. TABS.push(result);
  51. }
  52. });
  53. d.forEach(function(it) {
  54. let burl = pdfh(it, 'a&&href');
  55. log("burl >>>>>>" + burl);
  56. if (burl.startsWith("magnet")){
  57. let result = 'magnet' + magnetIndex;
  58. magnetIndex = magnetIndex + 1;
  59. TABS.push(result);
  60. }
  61. });
  62. log('4khdr TABS >>>>>>>>>>>>>>>>>>' + TABS);
  63. `,
  64. lists:`js:
  65. log(TABS);
  66. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  67. LISTS = [];
  68. var d = pdfa(html, 'table.t_table');
  69. TABS.forEach(function(tab) {
  70. log('tab >>>>>>>>' + tab);
  71. if (/^aliyun/.test(tab)) {
  72. let targetindex = parseInt(tab.substring(6));
  73. let index = 1;
  74. d.forEach(function(it){
  75. let burl = pdfh(it, 'a&&href');
  76. if (burl.startsWith("https://www.aliyundrive.com/s/")){
  77. if (index === targetindex){
  78. let title = pdfh(it, 'a&&Text');
  79. log('title >>>>>>>>>>>>>>>>>>>>>>>>>>' + title);
  80. burl = "http://127.0.0.1:9978/proxy?do=ali&type=push&url=" + encodeURIComponent(burl);
  81. log('burl >>>>>>>>>>>>>>>>>>>>>>>>>>' + burl);
  82. let loopresult = title + '$' + burl;
  83. LISTS.push([loopresult]);
  84. }
  85. index = index + 1;
  86. }
  87. });
  88. }
  89. });
  90. TABS.forEach(function(tab) {
  91. log('tab >>>>>>>>' + tab);
  92. if (/^magnet/.test(tab)) {
  93. let targetindex = parseInt(tab.substring(6));
  94. let index = 1;
  95. d.forEach(function(it){
  96. let burl = pdfh(it, 'a&&href');
  97. if (burl.startsWith("magnet")){
  98. if (index === targetindex){
  99. let title = pdfh(it, 'a&&Text');
  100. log('title >>>>>>>>>>>>>>>>>>>>>>>>>>' + title);
  101. log('burl >>>>>>>>>>>>>>>>>>>>>>>>>>' + burl);
  102. let loopresult = title + '$' + burl;
  103. LISTS.push([loopresult]);
  104. }
  105. index = index + 1;
  106. }
  107. });
  108. }
  109. });
  110. `,
  111. },
  112. 一级:'ul#waterfall li;a&&title;img&&src;div.auth.cl&&Text;a&&href',
  113. 搜索:`js:
  114. pdfh=jsp.pdfh;pdfa=jsp.pdfa;pd=jsp.pd;
  115. if (rule_fetch_params.headers.Cookie.startsWith("http")){
  116. rule_fetch_params.headers.Cookie=fetch(rule_fetch_params.headers.Cookie);
  117. let cookie = rule_fetch_params.headers.Cookie;
  118. setItem(RULE_CK, cookie);
  119. };
  120. log('4khdr search cookie>>>>>>>>>>>>>>>' + rule_fetch_params.headers.Cookie);
  121. let new_host= HOST + '/search.php';
  122. let new_html=request(new_host);
  123. let formhash = pdfh(new_html, 'input[name="formhash"]&&value');
  124. log("4khdr formhash>>>>>>>>>>>>>>>" + formhash);
  125. let params = 'formhash=' + formhash + '&searchsubmit=yes&srchtxt=' + KEY;
  126. let _fetch_params = JSON.parse(JSON.stringify(rule_fetch_params));
  127. let postData = {
  128. body: params
  129. };
  130. Object.assign(_fetch_params, postData);
  131. log("4khdr search postData>>>>>>>>>>>>>>>" + JSON.stringify(_fetch_params));
  132. let search_html = post( HOST + '/search.php', _fetch_params)
  133. //log("4khdr search result>>>>>>>>>>>>>>>" + search_html);
  134. let d=[];
  135. let dlist = pdfa(search_html, 'div#threadlist ul li');
  136. dlist.forEach(function(it){
  137. let title = pdfh(it, 'h3&&Text');
  138. if (searchObj.quick === true){
  139. if (title.includes(KEY)){
  140. title = KEY;
  141. }
  142. }
  143. let img = "";
  144. let content = pdfh(it, 'p:eq(3)&&Text');
  145. let desc = pdfh(it, 'p:eq(2)&&Text');
  146. let url = pd(it, 'a&&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. }