From 13559a6ec08a86c3aedcd664e1d5978a9b13485d Mon Sep 17 00:00:00 2001 From: dteviot Date: Mon, 7 Oct 2024 09:48:35 +1300 Subject: [PATCH] Add site https://www.powanjuan.cc See: https://github.com/dteviot/WebToEpub/issues/1541 --- plugin/js/parsers/PowanjuanParser.js | 39 ++++++++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 40 insertions(+) create mode 100644 plugin/js/parsers/PowanjuanParser.js diff --git a/plugin/js/parsers/PowanjuanParser.js b/plugin/js/parsers/PowanjuanParser.js new file mode 100644 index 00000000..a243d3db --- /dev/null +++ b/plugin/js/parsers/PowanjuanParser.js @@ -0,0 +1,39 @@ +"use strict"; + +parserFactory.register("powanjuan.cc", () => new PowanjuanParser()); + +class PowanjuanParser extends Parser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + let menu = dom.querySelector("div.catalog"); + return util.hyperlinksToChapterList(menu); + } + + findContent(dom) { + return dom.querySelector("#mycontent"); + } + + extractTitleImpl(dom) { + return dom.querySelector("h1"); + } + + extractLanguage() { + return "zh"; + } + + findChapterTitle(dom) { + return dom.querySelector("h1"); + } + + async fetchChapter(url) { + let options = { makeTextDecoder: () => new TextDecoder("gb2312") }; + return (await HttpClient.wrapFetch(url, options)).responseXML; + } + + getInformationEpubItemChildNodes(dom) { + return [...dom.querySelectorAll(".descTip, .descInfo")]; + } +} diff --git a/plugin/popup.html b/plugin/popup.html index 7c169f2c..bce3e0ac 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -713,6 +713,7 @@

Instructions

+