WuxiaWorldSite: fix novelUrl
This commit is contained in:
@@ -14,10 +14,12 @@ const novelsScraper = async (req, res) => {
|
|||||||
|
|
||||||
let novels = [];
|
let novels = [];
|
||||||
|
|
||||||
$(".a_item").each( (i, el) => {
|
$(".a_item").each((i, el) => {
|
||||||
const novelName = $(el).find("a").attr("title");
|
const novelName = $(el).find("a").attr("title");
|
||||||
const novelCover = baseUrl + $(el).find("a > img").attr("src");
|
const novelCover = baseUrl + $(el).find("a > img").attr("src");
|
||||||
const novelUrl = $(el).find(".name_views > a").attr("href");
|
|
||||||
|
let novelUrl = $(el).find(".name_views > a").attr("href").slice(1);
|
||||||
|
novelUrl += "/";
|
||||||
|
|
||||||
const novel = {
|
const novel = {
|
||||||
extensionId: 12,
|
extensionId: 12,
|
||||||
@@ -30,7 +32,7 @@ const novelsScraper = async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
res.json(novels);
|
res.json(novels);
|
||||||
}
|
};
|
||||||
|
|
||||||
const novelScraper = async (req, res) => {
|
const novelScraper = async (req, res) => {
|
||||||
const novelUrl = req.params.novelUrl;
|
const novelUrl = req.params.novelUrl;
|
||||||
@@ -74,7 +76,7 @@ const novelScraper = async (req, res) => {
|
|||||||
|
|
||||||
novel.Status = novel["Genre(s)"].pop();
|
novel.Status = novel["Genre(s)"].pop();
|
||||||
|
|
||||||
novel["Genre(s)"] = novel["Genre(s)"].join(",");
|
novel["Genre(s)"] = novel["Genre(s)"].join(",");
|
||||||
|
|
||||||
const novelID = $(".show-more-list").attr("data-id");
|
const novelID = $(".show-more-list").attr("data-id");
|
||||||
|
|
||||||
@@ -92,7 +94,7 @@ const novelScraper = async (req, res) => {
|
|||||||
let chapterName = $(el).text().split(/\t+/);
|
let chapterName = $(el).text().split(/\t+/);
|
||||||
const releaseDate = chapterName.pop();
|
const releaseDate = chapterName.pop();
|
||||||
chapterName = chapterName[0];
|
chapterName = chapterName[0];
|
||||||
let chapterUrl = $(el).attr("href");
|
let chapterUrl = $(el).attr("href");
|
||||||
chapterUrl = chapterUrl.split("/").pop();
|
chapterUrl = chapterUrl.split("/").pop();
|
||||||
|
|
||||||
const novel = {
|
const novel = {
|
||||||
@@ -138,15 +140,14 @@ const chapterScraper = async (req, res) => {
|
|||||||
|
|
||||||
chapterText = chapterText.join("\n");
|
chapterText = chapterText.join("\n");
|
||||||
|
|
||||||
const prevChapter = $(".pre").attr("href")
|
const prevChapter = $(".pre").attr("href")
|
||||||
? $(".pre").attr("href").split("/").pop()
|
? $(".pre").attr("href").split("/").pop()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const nextChapter = $(".next_sesction > a").attr("href")
|
const nextChapter = $(".next_sesction > a").attr("href")
|
||||||
? $(".next_sesction > a").attr("href").split("/").pop()
|
? $(".next_sesction > a").attr("href").split("/").pop()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
||||||
novelUrl += "/";
|
novelUrl += "/";
|
||||||
chapterUrl += "/";
|
chapterUrl += "/";
|
||||||
|
|
||||||
@@ -170,16 +171,17 @@ const searchScraper = async (req, res) => {
|
|||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
|
|
||||||
$ = cheerio.load(body);
|
$ = cheerio.load(body);
|
||||||
|
|
||||||
let novels = [];
|
let novels = [];
|
||||||
|
|
||||||
$(".a_item").each( (i, el) => {
|
$(".a_item").each((i, el) => {
|
||||||
const novelName = $(el).find(".name_views > a").attr("title");
|
const novelName = $(el).find(".name_views > a").attr("title");
|
||||||
const novelCover = baseUrl + $(el).find("a > img").attr("src");
|
const novelCover = baseUrl + $(el).find("a > img").attr("src");
|
||||||
const novelUrl = $(el).find(".name_views > a").attr("href");
|
let novelUrl = $(el).find(".name_views > a").attr("href").slice(1);
|
||||||
|
novelUrl += "/";
|
||||||
|
|
||||||
const novel = {
|
const novel = {
|
||||||
extensionId: 12,
|
extensionId: 12,
|
||||||
novelName,
|
novelName,
|
||||||
@@ -190,10 +192,9 @@ const searchScraper = async (req, res) => {
|
|||||||
novels.push(novel);
|
novels.push(novel);
|
||||||
});
|
});
|
||||||
|
|
||||||
res.json(novels)
|
res.json(novels);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
module.exports = WuxiaWorldSiteScraper = {
|
module.exports = WuxiaWorldSiteScraper = {
|
||||||
novelsScraper,
|
novelsScraper,
|
||||||
novelScraper,
|
novelScraper,
|
||||||
|
|||||||
Reference in New Issue
Block a user