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