fix(source): Novel Updates, FastNovel & Arnovel (#782)
* inoveltranslation update * Oops * fix eslint check? * update fastnovel * update for arnovel * xperimental * novel.sourceId
This commit is contained in:
+24
-26
@@ -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,
|
||||
|
||||
@@ -263,10 +263,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
|
||||
url: link,
|
||||
sourceId,
|
||||
}).then(r => r.json());
|
||||
chapterText =
|
||||
json.content.replace(/\n/g, '<br>') +
|
||||
'<br><hr><br>TL Notes:<br>' +
|
||||
json.notes.replace(/\n/g, '<br>');
|
||||
chapterText = json.content.replace(/\n/g, '<br>');
|
||||
if (json.notes) {
|
||||
chapterText +=
|
||||
'<br><hr><br>TL Notes:<br>' + json.notes.replace(/\n/g, '<br>');
|
||||
}
|
||||
} else if (isWordPress) {
|
||||
/**
|
||||
* Remove wordpress bloat tags
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user