diff --git a/src/sources/en/fastnovel.js b/src/sources/en/fastnovel.js index 1d3ee069..057ae9e0 100644 --- a/src/sources/en/fastnovel.js +++ b/src/sources/en/fastnovel.js @@ -14,7 +14,7 @@ const popularNovels = async page => { let novels = []; - loadedCheerio('.list-novel .row').each(function () { + loadedCheerio('.col-novel-main .list-novel .row').each(function () { const novelName = loadedCheerio(this).find('h3.novel-title > a').text(); const novelCover = loadedCheerio(this).find('img.cover').attr('src'); const novelUrl = loadedCheerio(this) @@ -53,28 +53,26 @@ const parseNovelAndChapters = async novelUrl => { novel.summary = loadedCheerio('div.desc-text').text().trim(); - novel.author = loadedCheerio('ul.info > li > h3') - .filter(function () { - return loadedCheerio(this).text().trim() === 'Author:'; - }) - .siblings() - .text(); - novel.genre = loadedCheerio('ul.info > li') - .filter(function () { - return loadedCheerio(this).find('h3').text().trim() === 'Genre:'; - }) - .text() - .trim() - .replace('Genre:', '') - .trim(); - - novel.status = loadedCheerio('ul.info > li > h3') - .filter(function () { - return loadedCheerio(this).text().trim() === 'Status:'; - }) - .next() - .text(); + loadedCheerio('ul.info > li > h3').each(function () { + let detailName = loadedCheerio(this).text(); + let detail = loadedCheerio(this) + .siblings() + .map((i, el) => loadedCheerio(el).text()) + .toArray() + .join(','); + switch (detailName) { + case 'Author:': + novel.author = detail; + break; + case 'Status:': + novel.status = detail; + break; + case 'Genre:': + novel.genre = detail; + break; + } + }); const novelId = loadedCheerio('#rating').attr('data-novel-id'); const getChapters = async id => { @@ -119,6 +117,7 @@ const parseChapter = async (novelUrl, chapterUrl) => { const chapterName = loadedCheerio('.chr-text').text(); + loadedCheerio('#chr-content > div,h6,p[style="display: none;"]').remove(); let chapterText = loadedCheerio('#chr-content').html(); const chapter = { sourceId, @@ -139,14 +138,13 @@ const searchNovels = async searchTerm => { let novels = []; - loadedCheerio('div.col-novel-main > div.list-novel > .row').each(function () { + loadedCheerio('.col-novel-main .list-novel .row').each(function () { + const novelName = loadedCheerio(this).find('h3.novel-title > a').text(); + const novelCover = loadedCheerio(this).find('img').attr('src'); const novelUrl = loadedCheerio(this) .find('h3.novel-title > a') .attr('href'); - const novelName = loadedCheerio(this).find('h3.novel-title > a').text(); - const novelCover = loadedCheerio(this).find('img').attr('src'); - if (novelUrl) { novels.push({ sourceId, diff --git a/src/sources/en/novelupdates.js b/src/sources/en/novelupdates.js index 045b12fc..63b092bc 100644 --- a/src/sources/en/novelupdates.js +++ b/src/sources/en/novelupdates.js @@ -263,10 +263,11 @@ const parseChapter = async (novelUrl, chapterUrl) => { url: link, sourceId, }).then(r => r.json()); - chapterText = - json.content.replace(/\n/g, '
') + - '


TL Notes:
' + - json.notes.replace(/\n/g, '
'); + chapterText = json.content.replace(/\n/g, '
'); + if (json.notes) { + chapterText += + '


TL Notes:
' + json.notes.replace(/\n/g, '
'); + } } else if (isWordPress) { /** * Remove wordpress bloat tags diff --git a/src/sources/multisrc/madara/MadaraGenerator.ts b/src/sources/multisrc/madara/MadaraGenerator.ts index be964c81..fbaca553 100644 --- a/src/sources/multisrc/madara/MadaraGenerator.ts +++ b/src/sources/multisrc/madara/MadaraGenerator.ts @@ -95,7 +95,15 @@ export const ArNovelScraper = new MadaraScraper( 59, 'https://arnovel.me/', 'ArNovel', - { 'useNewChapterEndpoint': true, 'lang': 'Arabic' }, + { + 'path': { + 'novels': 'home/novel', + 'novel': 'home/novel', + 'chapter': 'home/novel', + }, + 'useNewChapterEndpoint': true, + 'lang': 'Arabic', + }, ); export const MeioNovelScraper = new MadaraScraper( diff --git a/src/sources/multisrc/madara/MadaraScraper.js b/src/sources/multisrc/madara/MadaraScraper.js index d637b929..480a8907 100644 --- a/src/sources/multisrc/madara/MadaraScraper.js +++ b/src/sources/multisrc/madara/MadaraScraper.js @@ -172,10 +172,15 @@ class MadaraScraper { let chapterUrl = loadedCheerio(this).find('a').attr('href').split('/'); - chapterUrl[6] - ? (chapterUrl = chapterUrl[5] + '/' + chapterUrl[6]) - : (chapterUrl = chapterUrl[5]); - + if (novel.sourceId === 59) { + chapterUrl[7] + ? (chapterUrl = chapterUrl[6] + '/' + chapterUrl[7]) + : (chapterUrl = chapterUrl[6]); + } else { + chapterUrl[6] + ? (chapterUrl = chapterUrl[5] + '/' + chapterUrl[6]) + : (chapterUrl = chapterUrl[5]); + } novelChapters.push({ chapterName, releaseDate, chapterUrl }); }); diff --git a/src/sources/multisrc/madara/MadaraSources.json b/src/sources/multisrc/madara/MadaraSources.json index 0a8e5d15..c8461468 100644 --- a/src/sources/multisrc/madara/MadaraSources.json +++ b/src/sources/multisrc/madara/MadaraSources.json @@ -94,6 +94,11 @@ "baseUrl": "https://arnovel.me/", "sourceName": "ArNovel", "options": { + "path": { + "novels": "home/novel", + "novel": "home/novel", + "chapter": "home/novel" + }, "useNewChapterEndpoint": true, "lang": "Arabic" }