wuxia.blog: Fix chapters
This commit is contained in:
@@ -104,6 +104,35 @@ const novelScraper = async (req, res) => {
|
|||||||
novelChapters.push(chapter);
|
novelChapters.push(chapter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let moreChaptersUrl =
|
||||||
|
baseUrl +
|
||||||
|
"temphtml/_tempChapterList_all_" +
|
||||||
|
$("div#more").attr("data-nid") +
|
||||||
|
".html";
|
||||||
|
|
||||||
|
let moreChapters = await fetch(moreChaptersUrl);
|
||||||
|
let moreChaptersString = await moreChapters.text();
|
||||||
|
|
||||||
|
$ = cheerio.load(moreChaptersString);
|
||||||
|
|
||||||
|
$("a").each(function () {
|
||||||
|
const chapterName = $(this).text();
|
||||||
|
|
||||||
|
const releaseDate = $(this)[0]
|
||||||
|
.nextSibling.nodeValue.replace(/-/g, "/")
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
const chapterUrl = $(this).attr("href").replace(url, "");
|
||||||
|
|
||||||
|
const chapter = {
|
||||||
|
chapterName,
|
||||||
|
releaseDate,
|
||||||
|
chapterUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
novelChapters.push(chapter);
|
||||||
|
});
|
||||||
|
|
||||||
novel.novelChapters = novelChapters.reverse();
|
novel.novelChapters = novelChapters.reverse();
|
||||||
|
|
||||||
res.json(novel);
|
res.json(novel);
|
||||||
@@ -115,7 +144,6 @@ const chapterScraper = async (req, res) => {
|
|||||||
let chapterUrl = req.params.chapterUrl;
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
const url = `${baseUrl}novel/${novelUrl}/${chapterId}/${chapterUrl}`;
|
const url = `${baseUrl}novel/${novelUrl}/${chapterId}/${chapterUrl}`;
|
||||||
console.log(url);
|
|
||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
@@ -153,8 +181,6 @@ const searchScraper = async (req, res) => {
|
|||||||
|
|
||||||
const url = `${baseUrl}?search=${searchTerm}`;
|
const url = `${baseUrl}?search=${searchTerm}`;
|
||||||
|
|
||||||
console.log(url);
|
|
||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user