fix chapter object

This commit is contained in:
Rajarshee Chatterjee
2021-03-27 10:15:35 +05:30
parent 71520901a4
commit 48b8dc82c5
2 changed files with 10 additions and 34 deletions
+4 -23
View File
@@ -103,21 +103,21 @@ router.get("/novel/:novelUrl", (req, res) => {
let novelChapters = [];
$(".wp-manga-chapter").each(function (result) {
chapterName = $(this)
let name = $(this)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
releaseDate = $(this)
let date_upload = $(this)
.find("span")
.text()
.replace(/[\t\n]/g, "")
.trim();
chapterUrl = $(this).find("a").attr("href").replace(url, "");
chapter_url = $(this).find("a").attr("href").replace(url, "");
novelChapters.push({ chapterName, releaseDate, chapterUrl });
novelChapters.push({ name, date_upload, chapter_url });
});
novel.novelChapters = novelChapters.reverse();
@@ -194,25 +194,6 @@ router.get("/search/", (req, res) => {
$(".c-tabs-item__content").each(function (result) {
novelName = $(this).find("h4 > a").text();
// let novelDetails = {};
// $(this)
// .find(".post-content_item")
// .each(function (result) {
// detailName = $(this)
// .find(".summary-heading > h5")
// .text()
// .replace(/[\t\n]/g, "")
// .trim();
// detail = $(this)
// .find(".summary-content")
// .text()
// .replace(/[\t\n]/g, "")
// .trim();
// novelDetails[detailName] = detail;
// });
novelCover = $(this).find("img").attr("src");
novelUrl = $(this)
+6 -11
View File
@@ -97,28 +97,23 @@ router.get("/novel/:novelUrl", (req, res) => {
$(".tab-content")
.find("li")
.each(function (result) {
chapterName = $(this)
let name = $(this)
.find("a")
.text()
.replace(/[\t\n]/g, "")
.trim();
releaseDate = null;
// $(this)
// .find("span")
// .text()
// .replace(/[\t\n]/g, "")
// .trim();
date_upload = null;
chapterUrl = $(this)
chapter_url = $(this)
.find("a")
.attr("href")
.replace(baseUrl, "");
novelChapters.push({
chapterName,
releaseDate,
chapterUrl: chapterUrl.replace(`/${novelUrl}/`, ""),
name,
date_upload,
chapter_url: chapter_url.replace(`/${novelUrl}/`, ""),
});
});