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://boxnovel.com/novel";
|
||||
const searchUrl = "https://boxnovel.com/";
|
||||
@@ -125,7 +126,8 @@ const chapterScraper = async (req, res) => {
|
||||
$ = cheerio.load(body);
|
||||
|
||||
const chapterName = $("div.text-left > h3").text();
|
||||
const chapterText = $(".reading-content").text();
|
||||
let chapterText = $(".reading-content").html();
|
||||
chapterText = htmlToText(chapterText);
|
||||
|
||||
let nextChapter = null;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const cheerio = require("cheerio");
|
||||
const fetch = require("node-fetch");
|
||||
const { htmlToText } = require("html-to-text");
|
||||
|
||||
const baseUrl = "https://novelfull.com";
|
||||
|
||||
@@ -132,7 +133,8 @@ const chapterScraper = async (req, res) => {
|
||||
$ = cheerio.load(body);
|
||||
|
||||
const chapterName = $(".chapter-title").attr("title");
|
||||
const chapterText = $("#chapter-content").text();
|
||||
let chapterText = $("#chapter-content").html();
|
||||
chapterText = htmlToText(chapterText);
|
||||
|
||||
let nextChapter = null;
|
||||
if ($("a#next_chap").attr("href")) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const cheerio = require("cheerio");
|
||||
const fetch = require("node-fetch");
|
||||
const { htmlToText } = require("html-to-text");
|
||||
|
||||
const baseUrl = "https://readnovelfull.com";
|
||||
|
||||
@@ -132,7 +133,8 @@ const chapterScraper = async (req, res) => {
|
||||
$ = cheerio.load(body);
|
||||
|
||||
const chapterName = $(".chr-title").attr("title");
|
||||
const chapterText = $("#chr-content").text();
|
||||
let chapterText = $("#chr-content").html();
|
||||
chapterText = htmlToText(chapterText);
|
||||
|
||||
let nextChapter = null;
|
||||
if ($("a#next_chap").attr("href")) {
|
||||
|
||||
Reference in New Issue
Block a user