Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
See: #1279
  • Loading branch information
dteviot committed Apr 12, 2024
1 parent 4fa1e19 commit dcda723
Showing 1 changed file with 6 additions and 34 deletions.
40 changes: 6 additions & 34 deletions plugin/js/parsers/AsianovelParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,28 @@ class AsianovelParser extends Parser{
super();
}

async getChapterUrls(dom, chapterUrlsUI) {
return this.getChapterUrlsFromMultipleTocPages(dom,
AsianovelParser.extractPartialChapterList,
AsianovelParser.getUrlsOfTocPages,
chapterUrlsUI
);
};

static getUrlsOfTocPages(dom) {
let urls = []
let lastLink = [...dom.querySelectorAll(".summary__container .pagination a")]
.slice(-1);
if (0 < lastLink.length)
{
let max = parseInt(lastLink[0].textContent);
let href = lastLink[0].href;
let index = href.lastIndexOf("/", href.length - 2);
href = href.substring(0, index + 1);
for(let i = 2; i <= max; ++i) {
urls.push(href + i + "/");
}
}
return urls;
}

static extractPartialChapterList(dom) {
return [...dom.querySelectorAll(".summary__container .title a")]
async getChapterUrls(dom) {
return [...dom.querySelectorAll(".chapter-group__list a")]
.map(a => util.hyperLinkToChapter(a));
}

findContent(dom) {
let articles = [...dom.querySelectorAll("article")];
return (articles.length === 1)
? articles[0]
: articles[1];
return dom.querySelector("#chapter-content");
}

extractTitleImpl(dom) {
return dom.querySelector(".summary-classic__content .title a");
return dom.querySelector(".story__identity-title");
}

findChapterTitle(dom) {
return dom.querySelector("h2");
return dom.querySelector(".chapter__title");
}

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

getInformationEpubItemChildNodes(dom) {
return [...dom.querySelectorAll("div.summary-classic__text")];
return [...dom.querySelectorAll(".story__summary")];
}
}

0 comments on commit dcda723

Please sign in to comment.