From f9a915778b961b1c99299a31c0734981239b9ee8 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Tue, 15 Jun 2021 15:27:33 +0530 Subject: [PATCH] ComradeMao: Fix chapterUrl (Closes #34) --- src/en/comrademao/ComradeMaoScraper.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/en/comrademao/ComradeMaoScraper.js b/src/en/comrademao/ComradeMaoScraper.js index 6def0aa..649ec26 100644 --- a/src/en/comrademao/ComradeMaoScraper.js +++ b/src/en/comrademao/ComradeMaoScraper.js @@ -84,6 +84,17 @@ const novelScraper = async (req, res) => { let novelChapters = []; + let chapterUrlPrefix = $("tbody > tr") + .first() + .next() + .find("td > a") + .text() + .split(" "); + + chapterUrlPrefix.pop(); + + chapterUrlPrefix = chapterUrlPrefix.join("-").toLowerCase(); + const latestChapter = $("tbody > tr") .first() .next() @@ -94,7 +105,7 @@ const novelScraper = async (req, res) => { for (let i = 1; i <= latestChapter; i++) { const chapterName = "Chapter " + i; const releaseDate = null; - const chapterUrl = novelUrl + "-chapter-" + i + "/"; + const chapterUrl = chapterUrlPrefix + "-" + i + "/"; const chapter = { chapterName,