面包网.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. function verifyLogin(url) {
  2. let cnt = 0;
  3. let cookie = '';
  4. let r = Math.random();
  5. let yzm_url = getHome(url) + '/index.php/verify/index.html';
  6. log(`验证码链接:${yzm_url}`);
  7. let submit_url = getHome(url) + '/index.php/ajax/verify_check';
  8. log(`post登录链接:${submit_url}`);
  9. while (cnt < OCR_RETRY) {
  10. try {
  11. let {cookie, html} = reqCookie(yzm_url + '?r=' + r, {toBase64: true});
  12. let code = OcrApi.classification(html);
  13. log(`第${cnt + 1}次验证码识别结果:${code}`);
  14. html = post(submit_url, {
  15. headers: {Cookie: cookie},
  16. body: 'type=search&verify=' + code,
  17. });
  18. html = JSON.parse(html);
  19. if (html.code === 1) {
  20. log(`第${cnt + 1}次验证码提交成功`);
  21. log(cookie);
  22. return cookie // 需要返回cookie
  23. } else if (html.code !== 1 && cnt + 1 >= OCR_RETRY) {
  24. cookie = ''; // 需要清空返回cookie
  25. }
  26. } catch (e) {
  27. log(`第${cnt + 1}次验证码提交失败:${e.message}`);
  28. if (cnt + 1 >= OCR_RETRY) {
  29. cookie = '';
  30. }
  31. }
  32. cnt += 1
  33. }
  34. return cookie
  35. }
  36. globalThis.verifyLogin = verifyLogin;
  37. var rule = {
  38. 类型:'影视',//影视|听书|漫画|小说
  39. title:'面包网',
  40. host:'https://v.aiwule.com',
  41. url:'/vodshow/fyclass--------fypage---.html',
  42. searchUrl:'/vodsearch/**----------fypage---.html',
  43. searchable:2,
  44. quickSearch:0,
  45. filterable:0,
  46. headers:{
  47. 'User-Agent':'MOBILE_UA',
  48. },
  49. timeout:5000,
  50. class_parse:'.nav a;a&&Text;a&&href;/(\\d+)\.html',
  51. cate_exclude:'',
  52. play_parse:true,
  53. lazy:$js.toString(()=>{
  54. input = {parse:1,url:input,js:''};
  55. }),
  56. double:true,
  57. 推荐:'*',
  58. 一级:'.vod-list li;.pic a&&title;.lazyload&&data-original||data-background;.text-overflow&&Text;.pic a&&href',
  59. 二级:{
  60. title:'h1&&Text;.info a:eq(2)&&Text',
  61. img:'.lazyload&&data-original||src',
  62. desc:'.info span:eq(5)&&Text;.info a:eq(6)&&Text;.info a:eq(5)&&Text;.text-row-2:eq(0)&&Text;.text-overflow:eq(3)&&Text',
  63. content:'.text&&Text',
  64. tabs:'.playlist-tab li',
  65. lists:'.ewave-playlist-content:eq(#id)&&a',
  66. tab_text:'body&&Text',
  67. list_text:'body&&Text',
  68. list_url:'a&&href',
  69. list_url_prefix: '',
  70. },
  71. //搜索:'*',
  72. 搜索: $js.toString(() => {
  73. let cookie = getItem(RULE_CK, '');
  74. //log('储存的cookie:' + cookie);
  75. let ret = request(MY_URL, {
  76. headers: {
  77. Referer: encodeUrl(MY_URL),
  78. Cookie: cookie,
  79. }
  80. });
  81. if (/请输入验证码/.test(ret)) {
  82. //log(ret);
  83. cookie = verifyLogin(MY_URL);
  84. if (cookie) {
  85. log(`本次成功过验证,cookie:${cookie}`);
  86. setItem(RULE_CK, cookie);
  87. } else {
  88. log(`本次验证失败,cookie:${cookie}`);
  89. }
  90. ret = request(MY_URL, {
  91. headers: {
  92. Referer: encodeUrl(MY_URL),
  93. Cookie: cookie,
  94. }
  95. });
  96. }
  97. //log(ret);
  98. let d = [];
  99. let html = ret;
  100. let list = pdfa(html, 'ul.row&&li');
  101. list.forEach(item => {
  102. var title = pdfh(item, '.pic&&a&&title');
  103. var pic = pdfh(item, '.lazyload&&data-original||data-background');
  104. var desc = pdfh(item, '.text-overflow&&Text');
  105. var content = pdfh(item, 'span:eq(6)&&Text');
  106. var url = pdfh(item, '.pic&&a&&href');
  107. if (title) {
  108. d.push({
  109. title: title,
  110. img: pic,
  111. desc: desc,
  112. content: content,
  113. url: url
  114. });
  115. }
  116. });
  117. setResult(d);
  118. }),
  119. 搜索验证标识:'系统安全验证',
  120. }