From 7c9822c7b9423a5e35305d7a9b110a313718b08c Mon Sep 17 00:00:00 2001 From: dteviot Date: Tue, 17 Dec 2024 19:39:41 +1300 Subject: [PATCH] Add site https://www.69yuedu.net/ See: https://github.com/dteviot/WebToEpub/issues/1604 --- plugin/js/parsers/69shuParser.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/plugin/js/parsers/69shuParser.js b/plugin/js/parsers/69shuParser.js index a692fd98..15b0ab58 100644 --- a/plugin/js/parsers/69shuParser.js +++ b/plugin/js/parsers/69shuParser.js @@ -4,6 +4,7 @@ parserFactory.registerUrlRule( url => (util.extractHostName(url).includes("69shu")), () => new ShuParser() ); +parserFactory.register("69yuedu.net", () => new _69yueduParser()); class ShuParser extends Parser{ constructor() { @@ -46,3 +47,30 @@ class ShuParser extends Parser{ }); } } + +class _69yueduParser extends ShuParser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + let tocUrl = dom.querySelector("a.btn").href; + let toc = (await HttpClient.wrapFetch(tocUrl, this.makeOptions())).responseXML; + let menu = toc.querySelector("#chapters ul"); + return util.hyperlinksToChapterList(menu); + } + + makeOptions() { + return ({ + makeTextDecoder: () => new TextDecoder("gbk") + }); + } + + findChapterTitle(dom) { + return dom.querySelector("h1"); + } + + findContent(dom) { + return dom.querySelector("div.content"); + }; +}