My Novel Reader

小说阅读脚本,统一阅读样式,内容去广告、修正拼音字、段落整理,自动下一页

< Отзив за My Novel Reader

Въпрос/коментар

§
Публикуван на: 25.01.2018
Редактиран на: 25.01.2018

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

想添加一下小红花阅读,发现下一章获取不了,请指点。 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 这种方式该如何在脚本里获取下一章?

ywzhaiqiАвтор
§
Публикуван на: 25.01.2018
{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);
      }
    });
  }
},
§
Публикуван на: 26.01.2018

多谢,果然要增加函数啊

Публикувайте отговор

Влезте, за да публикувате отговор.