From f2319d8f33354c8ffbfd9c87cde8a2571b664320 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Fri, 4 Jun 2021 18:36:55 +0530 Subject: [PATCH] MTLNovel: Fix novelCover and chapterText --- src/en/mtlnovel/MTLNovelScraper.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/en/mtlnovel/MTLNovelScraper.js b/src/en/mtlnovel/MTLNovelScraper.js index 52b3a32..07bca01 100644 --- a/src/en/mtlnovel/MTLNovelScraper.js +++ b/src/en/mtlnovel/MTLNovelScraper.js @@ -2,7 +2,7 @@ const cheerio = require("cheerio"); const fetch = require("node-fetch"); const UserAgent = require("user-agents"); -const { scraper } = require("../../helper"); +const { scraper, parseHtml } = require("../../helper"); const baseUrl = "https://mtlnovel.com"; @@ -37,6 +37,7 @@ const novelsScraper = async (req, res) => { const novelScraper = async (req, res) => { const novelUrl = req.params.novelUrl; + const url = `${baseUrl}/${novelUrl}`; const body = await scraper(url); @@ -55,7 +56,7 @@ const novelScraper = async (req, res) => { novel.novelName = $("h1.entry-title").text(); - novel.novelCover = $("amp-img").attr("src"); + novel.novelCover = $(".nov-head > amp-img").attr("src"); novel.novelSummary = $("div.desc > h2").next().text(); @@ -131,7 +132,8 @@ const chapterScraper = async (req, res) => { $ = cheerio.load(body); const chapterName = $("h1.main-title").text(); - const chapterText = $("div.par").text(); + let chapterText = $("div.par").html(); + chapterText = parseHtml(chapterText); let nextChapter = null; if ($("a.next").attr("href")) {