Lightnovelpub: Fix chapterUrl

This commit is contained in:
Rajarshee Chatterjee
2021-07-03 16:31:55 +05:30
parent 430c7a7341
commit c3ef170385
+8 -12
View File
@@ -113,22 +113,18 @@ const parseNovelAndChapters = async (novelUrl) => {
let novelChapters = [];
let firstChapterNo, totalChapters;
totalChapters = $(".header-stats > span").first().text().match(/\d+/)[0];
firstChapterNo = $(".chapter-no").first().text().match(/\d+/)[0];
for (let i = firstChapterNo; i <= totalChapters; i++) {
const chapterName = "Chapter " + i;
const releaseDate = null;
const chapterUrl = "chapter-" + i;
$("ul.chapter-list > li").each(function (result) {
const chapterName = $(this).find(".chapter-title").text().trim();
const releaseDate = $(this).find("time").text().trim();
const chapterUrl = $(this)
.find("a")
.attr("href")
.replace(`/novel/${novelUrl}/`, "");
const chapter = { chapterName, releaseDate, chapterUrl };
novelChapters.push(chapter);
}
});
novel.chapters = novelChapters;