fix chapterUrl to avoid duplicate chapters
This commit is contained in:
@@ -82,16 +82,17 @@ router.get("/novel/:novelUrl", (req, res) => {
|
||||
let novelChapters = [];
|
||||
|
||||
$(".chapter").each(function (result) {
|
||||
chapterName = $(this).text();
|
||||
let chapterName = $(this).text();
|
||||
|
||||
releaseDate = null;
|
||||
let releaseDate = null;
|
||||
|
||||
chapterUrl = $(this).attr("href");
|
||||
let chapterUrl = $(this).attr("href");
|
||||
chapterUrl = chapterUrl.replace(`/${novelUrl}/`, "");
|
||||
|
||||
novelChapters.push({
|
||||
chapterName,
|
||||
releaseDate,
|
||||
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
|
||||
chapterUrl,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -109,10 +109,12 @@ router.get("/novel/:novelUrl", (req, res) => {
|
||||
|
||||
releaseDate = null;
|
||||
|
||||
chapterUrl = $(this)
|
||||
.find("a")
|
||||
.attr("href")
|
||||
.replace(baseUrl, "");
|
||||
chapterUrl = $(this).find("a").attr("href");
|
||||
|
||||
chapterUrl = chapterUrl.replace(
|
||||
`${baseUrl}/${novelUrl}/`,
|
||||
""
|
||||
);
|
||||
|
||||
if (volumeName.includes("Volume")) {
|
||||
chapterName = volumeName + " " + chapterName;
|
||||
@@ -121,7 +123,7 @@ router.get("/novel/:novelUrl", (req, res) => {
|
||||
novelChapters.push({
|
||||
chapterName,
|
||||
releaseDate,
|
||||
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
|
||||
chapterUrl,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -93,16 +93,17 @@ router.get("/novel/:novelUrl", (req, res) => {
|
||||
$(".panel-body")
|
||||
.find("li")
|
||||
.each(function (result) {
|
||||
chapterName = $(this).find("a").attr("title");
|
||||
let chapterName = $(this).find("a").attr("title");
|
||||
|
||||
releaseDate = null;
|
||||
let releaseDate = null;
|
||||
|
||||
chapterUrl = $(this).find("a").attr("href");
|
||||
let chapterUrl = $(this).find("a").attr("href");
|
||||
chapterUrl = chapterUrl.replace(`/${novelUrl}/`, "");
|
||||
|
||||
novelChapters.push({
|
||||
chapterName,
|
||||
releaseDate,
|
||||
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
|
||||
chapterUrl,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user