-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1625 from ImLJS/beta
Add Site truyennhabo
- Loading branch information
Showing
2 changed files
with
62 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,61 @@ | ||
"use strict"; | ||
|
||
parserFactory.register("truyennhabo.com", () => new TruyenParser()); | ||
|
||
class TruyenParser extends Parser { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
async getChapterUrls(dom) { | ||
const chapterLinks = [...dom.querySelectorAll("#clwd ul a")] | ||
const chapterTitles = [...dom.querySelectorAll("#clwd span.block")] | ||
const chapterUrls = []; | ||
for (let i = 0; i < chapterLinks.length; i++) { | ||
const chapterLink = chapterLinks[i]; | ||
const chapterTitle = chapterTitles[i]; | ||
chapterUrls.push({ | ||
sourceUrl: chapterLink.href, | ||
title: chapterTitle.textContent, | ||
}); | ||
}; | ||
return chapterUrls.reverse(); | ||
} | ||
|
||
findContent(dom) { | ||
return ( | ||
dom.querySelector("article.blog") | ||
); | ||
} | ||
|
||
extractTitleImpl(dom) { | ||
return dom.querySelector("h1"); | ||
} | ||
|
||
extractAuthor(dom) { | ||
let authorLabel = dom.querySelector("#extra-info dd"); | ||
return authorLabel?.textContent ?? super.extractAuthor(dom); | ||
} | ||
|
||
findChapterTitle(dom) { | ||
return dom.querySelector("header h1"); | ||
} | ||
|
||
findCoverImageUrl(dom) { | ||
return util.getFirstImgSrc(dom, "div.auto-rows-max"); | ||
} | ||
|
||
getInformationEpubItemChildNodes(dom) { | ||
return [...dom.querySelectorAll("div#synopsis")]; | ||
} | ||
|
||
removeUnwantedElementsFromContentElement(element) { | ||
let mark = element.querySelector("a"); | ||
mark.remove(); | ||
super.removeUnwantedElementsFromContentElement(element); | ||
} | ||
|
||
} | ||
|
||
|
||
|
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