Preserve chapter text format (#5)

This commit is contained in:
Rajarshee Chatterjee
2021-05-03 18:27:25 +05:30
committed by GitHub
parent 9d40d85ff3
commit 8b555e4616
4 changed files with 12 additions and 4 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
const cheerio = require("cheerio");
const fetch = require("node-fetch");
const { htmlToText } = require("html-to-text");
const baseUrl = "https://www.novelhall.com/";
@@ -107,7 +108,8 @@ const chapterScraper = async (req, res) => {
$ = cheerio.load(body);
const chapterName = $("h1").text();
const chapterText = $("div.entry-content").text();
let chapterText = $("div.entry-content").html();
chapterText = htmlToText(chapterText);
let nextChapter = null;
nextChapter = $('a[rel="next"]').attr("href");