readlightnovel: add volume number in chapter name

This commit is contained in:
Rajarshee Chatterjee
2021-04-28 12:28:46 +05:30
parent b09c11e55d
commit 38395738d5
+26 -18
View File
@@ -95,28 +95,36 @@ router.get("/novel/:novelUrl", (req, res) => {
let novelChapters = [];
$(".tab-content")
.find("li")
.each(function (result) {
chapterName = $(this)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
$(".panel").each(function (res) {
let volumeName = $(this).find("h4.panel-title").text();
releaseDate = null;
$(this)
.find("ul.chapter-chs > li")
.each(function (result) {
chapterName = $(this)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
chapterUrl = $(this)
.find("a")
.attr("href")
.replace(baseUrl, "");
releaseDate = null;
novelChapters.push({
chapterName,
releaseDate,
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
chapterUrl = $(this)
.find("a")
.attr("href")
.replace(baseUrl, "");
if (volumeName.includes("Volume")) {
chapterName = volumeName + " " + chapterName;
}
novelChapters.push({
chapterName,
releaseDate,
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
});
});
});
});
novel.novelChapters = novelChapters;