遇到阅读云

如图:
1

  • 方法一

    • 搜索js

      site=实际网站情况

      比如m54kanshu m43kanshu

         https://www.sososhu.com/?site=61ksw&q={{key}},
         {headers: 
         { "User-Agent": "Mozilla/5.0 (Linux; Android 10; PACM00 Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.79 Mobile Safari/537.36" }
         }
  • 列表规则js

          <js>
          if (result.match(/阅读云/)) {
           u = baseUrl.split(',')[0]
           cookie.removeCookie(u)
           java.startBrowserAwait(u, "验证")
           ck = cookie.getCookie(u)
           head = JSON.stringify({ headers: { 'Cookie': ck } })
           url = u + "," + head
           result = java.ajax(url)
            }
          result
        </js>
          .block > div > div:nth-child(n+1)
  • 方法二

    • 登录认证js

         var src = result.body();
         if(key && /ge_ua/.test(src)){
             url = java.ruleUrl;
             result = java.startBrowserAwait(url, "验证");
             }
         result
    • 请求头js

       
       @js:  
       JSON.stringify({"Referer": baseUrl,  
       "X-Requested-With": "mark.via",  
       "Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",  
       "User-Agent": "Mozilla/5.0 (Linux; Android 10; PACM00 Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.79 Mobile Safari/537.36"})
       
  • 方法三

    • 明月大佬提供

      • 搜索js

      site=实际网站情况

      比如m54kanshu m43kanshu

       
      ```js
              let su = String(`https://www.sososhu.com?q=${java.encodeURI(key, 'utf-8')}&site=dangyuedu&Submit=${java.encodeURI('搜索', 'utf-8')}`);
              let ht1 = java.get(su, {});
              
              let ck1 = ht1.header("set-cookie").split(";")[0];
              let o = String(ck1.split("=")[1]);
              java.log(o);
              let nonce = ht1.body().match(/var nonce = (\d+)/);
              if (nonce) nonce = +nonce[1];
              java.log(nonce);
              
              let d = 0;
              for (let i = 0; i < o.length; i++) {
                let r = o[i];
                if (/^[a-zA-Z0-9]$/.test(r)) {
                  d += o.charCodeAt(i) * (nonce + i);
                }
              }
              java.log(String(d));
              
              let body = String(`sum=${d}&nonce=${nonce}`);
              let hd = JSON.stringify({
                'Accept-Encoding': 'gzip, deflate, br, zstd',
                'Content-Type': 'application/x-www-form-urlencoded',
                'x-ge-ua-step': 'prev',
                'origin': 'https://www.sososhu.com',
                'x-requested-with': 'mark.via',
                'referer': su.replace('com', 'com/'),
                'Cookie': ck1
              });
              let ht2 = java.post(su, body, JSON.parse(hd));
              java.log(ht2.body());
              let ck2 = ht2.header("set-cookie").split(";")[0];
              java.log(ck2);
              
              let hd2 = JSON.stringify({
                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
                'Accept-Encoding': 'gzip, deflate, br, zstd',
                'cache-control': 'max-age=0',
                'upgrade-insecure-requests': '1',
                'x-requested-with': 'mark.via',
                'referer': su.replace('com', 'com/'),
                'Cookie': ck2
              });
              Packages.java.lang.Thread.sleep(5000);
              
              let sht = java.get(su, JSON.parse(hd2));
              let u1 = sht.header("location");
              java.log(u1);
              
              if (sht.header("location")) {
                u1 = "https://www.sososhu.com" + u1;
                let u2 = java.get(u1, JSON.parse(hd2)).header("location");
                java.log(u2);
                sht = java.get(u2, JSON.parse(hd2));
                java.put("sht", sht.body());
              } else {
                java.put("sht", sht.body());
              }
              
              su;
      ```
      
    • 列表规则

          <js>
          sht = java.get("sht");
          </js>

      遇到 1 5 2 6... 目录乱序解决办法

图1:

1

图2:

2

图3:

3

图4

4

  • 方法一

    • 通过文本 重新排序 有数字才能用

          //1 5 2 6目录乱序解决办法 复制到目录规则
          <js>
          var JsDom = Packages.org.jsoup.Jsoup;
          var Document = Packages.org.jsoup.nodes.Document;
          var Element = Packages.org.jsoup.nodes.Element;
          
          
          var document = JsDom.parse(src);
          
          //获取列表 此处要改 改成对应的 css选择器
          var links = document.select('.list_li > li > a');
          
          var list = [];
          for (var i = 0; i < links.size(); i++) {
              var link = links.get(i);
              list.push({
                  text: link.text(),
                  url: link.attr('href')
              });
          }
          
          //排序
          list.sort(function(a, b) {
              var pageA = parseInt(a.text.match(/\d+/)[0], 10);
              var pageB = parseInt(b.text.match(/\d+/)[0], 10);
              return pageA - pageB;
          });
          
          
          java.log(JSON.stringify(list));
          list;
      </js>
  • 方法二

    • 通过属性ID 重新排序

          <js>
          var JsDom = Packages.org.jsoup.Jsoup;
          var Document = Packages.org.jsoup.nodes.Document;
          var Element = Packages.org.jsoup.nodes.Element;
          
          var document = JsDom.parse(src);
          
          // 获取列表 第一次需要修改的地方 修改正确的css 选择器
          var links = document.select('#chapter-list > dd');
          
          var list = [];
          for (var i = 0; i < links.size(); i++) {
              var dd = links.get(i);
              var a = dd.select('a').first(); 
              if (a != null) { 
                  list.push({
                      text: a.text(),
                      id: dd.attr('id').replace('c', ''), //获取ID属性 需要自己手动改 第二处需要修改的地
                      url: a.attr('href')
                  });
              } 
          }
          
          // 排序
          list.sort(function(a, b) {
              var pageA = parseInt(a.id, 10);
              var pageB = parseInt(b.id, 10);
              return pageA - pageB;
          });
          
          java.log(JSON.stringify(list));
          list;
          </js>
          //搞定 获取ID 属性得自己手动改
  • 方法三

    • 通过id属性 重新排序2.0

       <js>
      var JsDom = Packages.org.jsoup.Jsoup;
      var Document = Packages.org.jsoup.nodes.Document;
      var Element = Packages.org.jsoup.nodes.Element;
                  
      var document = JsDom.parse(src);
                  
      // 获取包含<li>元素的<div>元素
      var divs = document.select('ul.list > div');
      
      // 将divs转换为数组以便排序
      var divArray = [];
      for (var i = 0; i < divs.size(); i++) {
          divArray.push(divs.get(i));
      }
      
      // 按照data-id属性对divArray进行排序
      divArray.sort(function(a, b) {
          var pageA = parseInt(a.attr('data-id'), 10);
          var pageB = parseInt(b.attr('data-id'), 10);
          return pageA - pageB;
      });
      
      var list = [];
      // 遍历排序后的divArray
      for (var i = 0; i < divArray.length; i++) {
          var div = divArray[i];
          var dataId = div.attr('data-id');
          // 获取当前div下的所有<li>元素
          var lis = div.select('li');
          for (var j = 0; j < lis.size(); j++) {
              var li = lis.get(j);
              var a = li.select('a').first();
              if (a != null) {
                  list.push({
                      text: a.text(),
                      id: dataId, // 使用data-id属性
                      url: a.attr('href')
                  });
              }
          }
      }
      
      java.log(JSON.stringify(list));
      list;
      </js>
分类: 书源编写书源开源阅读 标签: 教程编写书源书源日记开源阅读阅读app写源

评论

暂无评论数据

暂无评论数据

目录