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