EinherjarProject: fix chapterUrl & NovelasLigera: fix novelCover

This commit is contained in:
Rajarshee Chatterjee
2021-06-02 12:53:47 +05:30
parent 894e4e8e9b
commit 7e974b47bb
2 changed files with 10 additions and 6 deletions
@@ -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();
+6 -4
View File
@@ -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 += "/";