Này người xa lạ!

Còn chờ gì nữa mà không mau đăng nhập hoặc đăng ký để cùng tham gia thảo luận với cộng đồng!

请教小红花阅读的下一章如何获取

About: My Novel Reader
đã sửa January 2018 trong Thảo luận về Script Firefox

想添加一下小红花阅读,发现下一章获取不了,请指点。
https://xhhread.com/read/reading.jhtml?chapterid=8aada6395a597779015a93a372c90a55
自己添加的代码:

// @include        *://xhhread.com/read/*

  {siteName: "小红花阅读",
      url: "https?://xhhread\\.com/read/*",
      titleSelector: ".reading-title",
      contentSelector: ".middle-wrapper2",
      nextSelector: '.reading-end a:nth-of-type(1)',
      prevSelector: '.reading-end a:nth-of-type(2)',
      indexSelector: '.reading-end a:nth-of-type(3)',
      contentRemove: '.zan',
  },

底部导航栏部分的页面代码是这样的:

    <!--底部导航栏-->
    <div class="reading-end middle-wrapper2">
        <a class="cannot">上一章</a>
        <a class="H_content" p="8aada6395a597779015a898b0e530308" target="_self" style="center">目录</a>
        <a class="H_readnextforwap" p="8aada6395a597779015a93a372c90a55" target="self">下一章</a>
    </div>

手动点击下一章之后的link实际为
https://xhhread.com/read/readnextforwap.jhtml?chapterid=8aada6395a597779015a93a372c90a55
这种方式该如何在脚本里获取下一章?

Bình luận

  • {siteName: '小红花阅读网',
      exampleUrl: 'https://xhhread.com/read/reading.jhtml?chapterid=8aada6395a597779015a93a372c90a55',
      url: '^https?://xhhread\\.com/read/read\\w+\\.jhtml\\?chapterid=.*',
      bookTitleSelector: '.H_book',
      titleSelector: '.reading-title',
      contentPatch: function($doc) {
        // 修正上下页链接
        var rules = {
          '.H_readpreforwap': 'https://xhhread.com/read/readpreforwap.jhtml?chapterid=',
          '.H_content': 'https://xhhread.com/read/contents.jhtml?storyid=',
          '.H_readnextforwap': 'https://xhhread.com/read/readnextforwap.jhtml?chapterid=',
        };
    
        Object.keys(rules).forEach(function(selector) {
          var $link = $doc.find(selector);
          var chapterId = $link.attr('p');
          if (chapterId) {
            var url = rules[selector];
            $link.attr('href', url + chapterId);
          }
        });
      }
    },
    
  • 多谢,果然要增加函数啊
Đăng nhập hoặc Đăng ký để gửi bình luận.