Tunovelaligera: add volumeUrl

This commit is contained in:
Rajarshee Chatterjee
2021-06-01 07:52:34 +05:30
parent 399ceda301
commit fd739decd5
2 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ router.get("/novels/", tunovelaligeraScraper.novelsScraper);
router.get("/novel/:novelUrl", tunovelaligeraScraper.novelScraper);
router.get(
"/novel/:novelUrl/:chapterUrl",
"/novel/:novelUrl/:volumeUrl?/:chapterUrl",
tunovelaligeraScraper.chapterScraper
);
+11 -2
View File
@@ -144,8 +144,17 @@ const novelScraper = async (req, res) => {
const chapterScraper = async (req, res) => {
let novelUrl = req.params.novelUrl;
let chapterUrl = req.params.chapterUrl;
let volumeUrl = req.params.volumeUrl;
const url = `${baseUrl}novelas/${novelUrl}/${chapterUrl}`;
let optionalUrl;
if (volumeUrl) {
optionalUrl = volumeUrl + "/";
} else {
optionalUrl = "";
}
const url = `${baseUrl}novelas/${novelUrl}/${optionalUrl}${chapterUrl}/`;
const result = await fetch(url);
const body = await result.text();
@@ -176,7 +185,7 @@ const chapterScraper = async (req, res) => {
}
novelUrl = novelUrl + "/";
chapterUrl = chapterUrl + "/";
chapterUrl = optionalUrl + chapterUrl;
const chapter = {
extensionId: 23,