Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
See: #1654
  • Loading branch information
dteviot committed Jan 28, 2025
1 parent 2c6c658 commit 51f65c7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions plugin/js/parsers/Novel543Parser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"use strict";

parserFactory.register("novel543.com", () => new Novel543Parser());

class Novel543Parser extends Parser{
constructor() {
super();
}

async getChapterUrls(dom) {
let tocUrl = dom.baseURI + "dir";
let nextDom = (await HttpClient.wrapFetch(tocUrl)).responseXML;
let menu = nextDom.querySelector("div.chaplist ul:nth-of-type(2)");
return util.hyperlinksToChapterList(menu);
}

findContent(dom) {
return dom.querySelector("div.chapter-content");
}

extractTitleImpl(dom) {
return dom.querySelector("h1.title");
}

extractAuthor(dom) {
let authorLabel = dom.querySelector("span.author");
return authorLabel?.textContent ?? super.extractAuthor(dom);
}

extractLanguage() {
return "zh";
}

findCoverImageUrl(dom) {
return util.getFirstImgSrc(dom, "div.cover");
}

async fetchChapter(url) {
return this.walkPagesOfChapter(url, this.moreChapterTextUrl);
}

moreChapterTextUrl(dom) {
let has2underscores = (s) => ((s.match(/_/g) || []).length === 2);
let nextUrl = [...dom.querySelectorAll(".foot-nav a")].pop();
return ((nextUrl != null) && has2underscores(nextUrl.href))
? nextUrl.href
: null;
}

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("div.intro")];
}
}
1 change: 1 addition & 0 deletions plugin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ <h3>Instructions</h3>
<script src="js/parsers/NanodesuParser.js"></script>
<script src="js/parsers/NanomashinonlineParser.js"></script>
<script src="js/parsers/NoblemtlParser.js"></script>
<script src="js/parsers/Novel543Parser.js"></script>
<script src="js/parsers/NovelAllParser.js"></script>
<script src="js/parsers/NovelcoolParser.js"></script>
<script src="js/parsers/NovelCrushParser.js"></script>
Expand Down

0 comments on commit 51f65c7

Please sign in to comment.