From bc3cbd7d7bb80481885e2300b1eec3bd6b0756c8 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Tue, 3 May 2022 11:56:09 +0530 Subject: [PATCH] fix(source): NovelRingan: Fix Cover (Closes LNReader/lnreader-sources#209) --- src/sources/id/novelringan.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sources/id/novelringan.js b/src/sources/id/novelringan.js index 02818edb..1a8ce5b2 100644 --- a/src/sources/id/novelringan.js +++ b/src/sources/id/novelringan.js @@ -6,7 +6,7 @@ const sourceId = 86; const sourceName = 'NovelRingan'; const baseUrl = 'https://novelringan.com/'; -const searchUrl = `${baseUrl}advanced-search`; +const coverUriPrefix = 'https://i0.wp.com/novelringan.com/wp-content/uploads/'; const popularNovels = async page => { let totalPages = 402; @@ -21,7 +21,8 @@ const popularNovels = async page => { loadedCheerio('article.post').each(function () { const novelName = loadedCheerio(this).find('.entry-title').text()?.trim(); - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = + coverUriPrefix + loadedCheerio(this).find('img').attr('data-sxrx'); const novelUrl = loadedCheerio(this).find('h2 > a').attr('href'); const novel = { @@ -61,7 +62,8 @@ const parseNovelAndChapters = async novelUrl => { }; novel.novelName = loadedCheerio('.entry-title').text()?.trim(); - novel.novelCover = loadedCheerio('img.ts-post-image').attr('src'); + novel.novelCover = + coverUriPrefix + loadedCheerio('img.ts-post-image').attr('data-sxrx'); novel.summary = loadedCheerio( 'body > div.site-container > div > main > article > div > div.maininfo > span > p', ).text(); @@ -137,7 +139,9 @@ const searchNovels = async searchTerm => { loadedCheerio('article.post').each(function () { const novelName = loadedCheerio(this).find('.entry-title').text(); - const novelCover = loadedCheerio(this).find('img').attr('src'); + const novelCover = + coverUriPrefix + loadedCheerio(this).find('img').attr('data-sxrx'); + const novelUrl = loadedCheerio(this).find('h2 > a').attr('href'); const novel = {