EinherjarProject: fix chapterUrl & NovelasLigera: fix novelCover
This commit is contained in:
@@ -101,10 +101,12 @@ const novelScraper = async (req, res) => {
|
|||||||
if ($(this).find("a").text()) {
|
if ($(this).find("a").text()) {
|
||||||
const chapterName = $(this).text();
|
const chapterName = $(this).text();
|
||||||
const releaseDate = null;
|
const releaseDate = null;
|
||||||
const chapterUrl = $(this)
|
let chapterUrl = $(this)
|
||||||
.find("a")
|
.find("a")
|
||||||
.attr("href")
|
.attr("href")
|
||||||
.replace(baseUrl, "");
|
.replace(baseUrl, "");
|
||||||
|
if (chapterUrl.includes(novelUrl + "/"))
|
||||||
|
chapterUrl = chapterUrl.replace(novelUrl + "/", "");
|
||||||
|
|
||||||
const chapter = { chapterName, releaseDate, chapterUrl };
|
const chapter = { chapterName, releaseDate, chapterUrl };
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ const chapterScraper = async (req, res) => {
|
|||||||
let chapterUrl = req.params.chapterUrl;
|
let chapterUrl = req.params.chapterUrl;
|
||||||
|
|
||||||
const url = baseUrl + chapterUrl;
|
const url = baseUrl + chapterUrl;
|
||||||
|
console.log(url);
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
const body = await result.text();
|
const body = await result.text();
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const novelScraper = async (req, res) => {
|
|||||||
|
|
||||||
novel.novelName = $("h1").text();
|
novel.novelName = $("h1").text();
|
||||||
|
|
||||||
novel.novelCover = $(".swiper-slide-image").attr("src");
|
novel.novelCover = $(".elementor-widget-container").find("img").attr("src");
|
||||||
|
|
||||||
$(".elementor-row")
|
$(".elementor-row")
|
||||||
.find("p")
|
.find("p")
|
||||||
@@ -192,11 +192,13 @@ const searchScraper = async (req, res) => {
|
|||||||
const novelCover = $(this).find("img").attr("src");
|
const novelCover = $(this).find("img").attr("src");
|
||||||
let novelUrl = $(this).find("a").attr("href").split("/")[4];
|
let novelUrl = $(this).find("a").attr("href").split("/")[4];
|
||||||
|
|
||||||
const novelName = novelUrl
|
let novelName;
|
||||||
.replace(/-/g, " ")
|
|
||||||
.replace(/^./, function (x) {
|
if (novelUrl) {
|
||||||
|
novelName = novelUrl.replace(/-/g, " ").replace(/^./, function (x) {
|
||||||
return x.toUpperCase();
|
return x.toUpperCase();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
novelUrl += "/";
|
novelUrl += "/";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user