From e022a901ebad81994984530e0cce95304111afe3 Mon Sep 17 00:00:00 2001 From: dteviot Date: Mon, 11 Sep 2023 12:35:56 +1200 Subject: [PATCH] Add site https://bookswithqianya.com See: https://github.com/dteviot/WebToEpub/issues/1069 --- plugin/js/parsers/BookswithqianyaParser.js | 30 ++++++++++++++++++++++ plugin/popup.html | 1 + 2 files changed, 31 insertions(+) create mode 100644 plugin/js/parsers/BookswithqianyaParser.js diff --git a/plugin/js/parsers/BookswithqianyaParser.js b/plugin/js/parsers/BookswithqianyaParser.js new file mode 100644 index 00000000..261c3d54 --- /dev/null +++ b/plugin/js/parsers/BookswithqianyaParser.js @@ -0,0 +1,30 @@ +"use strict"; + +parserFactory.register("bookswithqianya.com", () => new BookswithqianyaParser()); + +class BookswithqianyaParser extends WordpressBaseParser{ + constructor() { + super(); + } + + async getChapterUrls(dom) { + return [...dom.querySelectorAll("div.elementor-tab-content a")] + .map(a => util.hyperLinkToChapter(a)) + .filter(c => this.isChapterUrl(c.sourceUrl)); + } + + isChapterUrl(url) { + return !url.includes("/products/") + && !url.includes("/novels/") + && !url.includes("myrics"); + } + + extractTitleImpl(dom) { + return dom.querySelector(".elementor-image-box-title"); + } + + removeUnwantedElementsFromContentElement(element) { + util.removeChildElementsMatchingCss(element, "button"); + super.removeUnwantedElementsFromContentElement(element); + } +} diff --git a/plugin/popup.html b/plugin/popup.html index 11554d56..f4a85720 100644 --- a/plugin/popup.html +++ b/plugin/popup.html @@ -542,6 +542,7 @@

Instructions

+