Preserve chapter text format (#5)
This commit is contained in:
committed by
GitHub
parent
9d40d85ff3
commit
8b555e4616
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user