From 724d13173eacb2085d0ba06f903fb58593849044 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Thu, 20 May 2021 08:52:20 +0530 Subject: [PATCH] LightNovelPub: Fix search --- src/en/lightnovelpub/LightNovelPubScraper.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/en/lightnovelpub/LightNovelPubScraper.js b/src/en/lightnovelpub/LightNovelPubScraper.js index c34944d..0ce8885 100644 --- a/src/en/lightnovelpub/LightNovelPubScraper.js +++ b/src/en/lightnovelpub/LightNovelPubScraper.js @@ -165,15 +165,16 @@ const searchScraper = async (req, res) => { const url = `${baseUrl}lnwsearchlive?inputContent=${searchTerm}`; - const result = await fetch(url); - const body = await result.json(); + const result = await scraper(url); - const data = body.resultview; - - $ = cheerio.load(data); + $ = cheerio.load(result); let novels = []; + let results = JSON.parse($("body").text()); + + $ = cheerio.load(results.resultview); + $(".novel-item").each(function (result) { const novelName = $(this).find("h4.novel-title").text(); const novelCover = $(this).find("img").attr("src");