MTLNovel: Fix search

This commit is contained in:
Rajarshee Chatterjee
2021-06-05 16:01:25 +05:30
parent d4fe91a3e2
commit 62d414baf2
+5 -21
View File
@@ -167,30 +167,14 @@ const searchScraper = async (req, res) => {
searchTerm +
"&__amp_source_origin=https%3A%2F%2Fwww.mtlnovel.com";
const result = await fetch(searchUrl);
const body = await result.json();
const result = await scraper(searchUrl);
$ = cheerio.load(result);
let body = JSON.parse($("body").text());
let novels = [];
// $("div.box").each(function (result) {
// const novelName = $(this).find("a.list-title").text();
// if (novelName && novelName !== "{{permalink}}") {
// const novelCover = $(this).find("amp-img").attr("src");
// let novelUrl = $(this).find("a").attr("href");
// novelUrl = novelUrl.replace("https://www.mtlnovel.com/", "");
// const novel = {
// extensionId: 5,
// novelUrl,
// novelName,
// novelCover,
// };
// novels.push(novel);
// }
// });
body.items[0].results.map((item) => {
const novelName = item.title.replace(/<\/?strong>/g, "");
const novelCover = item.thumbnail;