-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update site https://allnovelnext.com
- added alias https://novelfull.com - added alias https://novelfull.net - lint tests ok (reached Wrote Zip to disk) - unit tests passed (Tests completed in 631 milliseconds. 566 assertions of 566 passed, 0 failed.) - added name to package.json and readme.md
- Loading branch information
Showing
5 changed files
with
62 additions
and
1 deletion.
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
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,56 @@ | ||
"use strict"; | ||
|
||
parserFactory.register("novelnext.com", () => new NovelNextParser()); | ||
|
||
class NovelNextParser extends Parser{ | ||
constructor() { | ||
super(); | ||
} | ||
|
||
getChapterUrls(dom) { | ||
let chapters = NovelNextParser.extractChapterList(dom) | ||
if (0 < chapters.length) { | ||
return Promise.resolve(chapters); | ||
} | ||
return NovelNextParser.fetchChapterList(dom); | ||
}; | ||
|
||
static fetchChapterList(dom) { | ||
let novelId = dom.querySelector("div#rating").getAttribute("data-novel-id"); | ||
let url = `https://novelnext.com/novelnext/${novelId}`; | ||
return HttpClient.wrapFetch(url).then(function (xhr) { | ||
return NovelNextParser.extractChapterList(xhr.responseXML); | ||
}); | ||
} | ||
|
||
static extractChapterList(dom) { | ||
return [...dom.querySelectorAll("ul.list-chapter a")] | ||
.map(a => util.hyperLinkToChapter(a)); | ||
} | ||
|
||
findContent(dom) { | ||
return dom.querySelector("div#chr-content"); | ||
}; | ||
|
||
extractTitleImpl(dom) { | ||
return dom.querySelector("h3.title"); | ||
}; | ||
|
||
extractAuthor(dom) { | ||
let authorLabel = dom.querySelector("ul.info li:nth-of-type(2) a"); | ||
return (authorLabel === null) ? super.extractAuthor(dom) : authorLabel.textContent; | ||
}; | ||
|
||
findChapterTitle(dom) { | ||
return dom.querySelector("a.chr-title").textContent; | ||
} | ||
|
||
findCoverImageUrl(dom) { | ||
return util.getFirstImgSrc(dom, "div.book"); | ||
} | ||
|
||
getInformationEpubItemChildNodes(dom) { | ||
return [...dom.querySelectorAll("div.desc-text")]; | ||
} | ||
|
||
} |
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
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
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