-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See: #1654
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters