novel-updates: added infinitenoveltranslations (#1110)
This commit is contained in:
+149
-131
@@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin';
|
|||||||
class NovelUpdates implements Plugin.PluginBase {
|
class NovelUpdates implements Plugin.PluginBase {
|
||||||
id = 'novelupdates';
|
id = 'novelupdates';
|
||||||
name = 'Novel Updates';
|
name = 'Novel Updates';
|
||||||
version = '0.7.3';
|
version = '0.7.4';
|
||||||
icon = 'src/en/novelupdates/icon.png';
|
icon = 'src/en/novelupdates/icon.png';
|
||||||
customCSS = 'src/en/novelupdates/customCSS.css';
|
customCSS = 'src/en/novelupdates/customCSS.css';
|
||||||
site = 'https://www.novelupdates.com/';
|
site = 'https://www.novelupdates.com/';
|
||||||
@@ -206,20 +206,19 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
|
|
||||||
switch (targetDomain) {
|
switch (targetDomain) {
|
||||||
case 'anotivereads':
|
case 'anotivereads':
|
||||||
chapterTitle = loadedCheerio('#comic-nav-name').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('#spliced-comic').html()!;
|
loadedCheerio('#comic-nav-name').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('#spliced-comic').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'asuratls':
|
case 'asuratls':
|
||||||
const titleElement_asura = loadedCheerio('.post-body div b').first();
|
const titleElement_asura = loadedCheerio('.post-body div b').first();
|
||||||
chapterTitle = titleElement_asura.text()!;
|
chapterTitle = titleElement_asura.text() || 'Title not found';
|
||||||
titleElement_asura.remove();
|
titleElement_asura.remove();
|
||||||
chapterContent = loadedCheerio('.post-body').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.post-body').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'fictionread':
|
case 'fictionread':
|
||||||
bloatClasses = [
|
bloatClasses = [
|
||||||
@@ -229,7 +228,9 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'.word',
|
'.word',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('.title-image span').first().text()!;
|
chapterTitle =
|
||||||
|
loadedCheerio('.title-image span').first().text() ||
|
||||||
|
'Title not found';
|
||||||
loadedCheerio('.content')
|
loadedCheerio('.content')
|
||||||
.children()
|
.children()
|
||||||
.each((_, ele) => {
|
.each((_, ele) => {
|
||||||
@@ -238,10 +239,9 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
chapterContent = loadedCheerio('.content').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.content').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'genesistudio':
|
case 'genesistudio':
|
||||||
const url_genesis = `${url}/__data.json?x-sveltekit-invalidated=001`;
|
const url_genesis = `${url}/__data.json?x-sveltekit-invalidated=001`;
|
||||||
@@ -254,7 +254,9 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
chapterText = data_genesis[data_genesis[0].content];
|
chapterText = data_genesis[data_genesis[0].content];
|
||||||
break;
|
break;
|
||||||
case 'helscans':
|
case 'helscans':
|
||||||
chapterTitle = loadedCheerio('.entry-title-main').first().text()!;
|
chapterTitle =
|
||||||
|
loadedCheerio('.entry-title-main').first().text() ||
|
||||||
|
'Title not found';
|
||||||
const chapterString_helscans =
|
const chapterString_helscans =
|
||||||
'Chapter ' + chapterTitle.split('Chapter')[1].trim();
|
'Chapter ' + chapterTitle.split('Chapter')[1].trim();
|
||||||
loadedCheerio('#readerarea.rdminimal')
|
loadedCheerio('#readerarea.rdminimal')
|
||||||
@@ -267,24 +269,41 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
chapterContent = loadedCheerio('#readerarea.rdminimal').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('#readerarea.rdminimal').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'hiraethtranslation':
|
case 'hiraethtranslation':
|
||||||
chapterTitle = loadedCheerio('li.active').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.text-left').html()!;
|
loadedCheerio('li.active').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('.text-left').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'hostednovel':
|
case 'hostednovel':
|
||||||
chapterTitle = loadedCheerio('#chapter-title').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('#chapter-content').html()!;
|
loadedCheerio('#chapter-title').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('#chapter-content').html() || 'Content not found';
|
||||||
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
|
break;
|
||||||
|
case 'infinitenoveltranslations':
|
||||||
|
/**
|
||||||
|
* Get the chapter link from the main page
|
||||||
|
*/
|
||||||
|
const link_infinite = loadedCheerio('.cm-entry-summary > p > a').attr(
|
||||||
|
'href',
|
||||||
|
)!;
|
||||||
|
if (link_infinite) {
|
||||||
|
const result_infinite = await fetchApi(link_infinite);
|
||||||
|
const body_infinite = await result_infinite.text();
|
||||||
|
loadedCheerio = parseHTML(body_infinite);
|
||||||
}
|
}
|
||||||
|
chapterContent =
|
||||||
|
loadedCheerio('.cm-entry-summary').html() || 'Content not found';
|
||||||
|
chapterTitle =
|
||||||
|
loadedCheerio('.cm-entry-title').text() || 'Title not found';
|
||||||
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'inoveltranslation':
|
case 'inoveltranslation':
|
||||||
const link_inovel = 'https://api.' + url.slice(8);
|
const link_inovel = 'https://api.' + url.slice(8);
|
||||||
@@ -297,9 +316,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'<br><hr><br>TL Notes:<br>' +
|
'<br><hr><br>TL Notes:<br>' +
|
||||||
json_inovel.notes.replace(/\n/g, '<br>');
|
json_inovel.notes.replace(/\n/g, '<br>');
|
||||||
}
|
}
|
||||||
if (chapterTitle && chapterContent) {
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'isotls': // mii translates
|
case 'isotls': // mii translates
|
||||||
bloatClasses = [
|
bloatClasses = [
|
||||||
@@ -311,11 +328,11 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'.ezoic-videopicker-video',
|
'.ezoic-videopicker-video',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('head title').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('main article').html()!;
|
loadedCheerio('head title').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('main article').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'ko-fi':
|
case 'ko-fi':
|
||||||
const matchResult_kofi = loadedCheerio(
|
const matchResult_kofi = loadedCheerio(
|
||||||
@@ -335,21 +352,20 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
const titleElement_mirilu = loadedCheerio(
|
const titleElement_mirilu = loadedCheerio(
|
||||||
'.entry-content p strong',
|
'.entry-content p strong',
|
||||||
).first();
|
).first();
|
||||||
chapterTitle = titleElement_mirilu.text()!;
|
chapterTitle = titleElement_mirilu.text() || 'Title not found';
|
||||||
titleElement_mirilu.remove();
|
titleElement_mirilu.remove();
|
||||||
chapterContent = loadedCheerio('.entry-content').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.entry-content').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'novelplex':
|
case 'novelplex':
|
||||||
bloatClasses = ['.passingthrough_adreminder'];
|
bloatClasses = ['.passingthrough_adreminder'];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('.halChap--jud').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.halChap--kontenInner ').html()!;
|
loadedCheerio('.halChap--jud').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('.halChap--kontenInner ').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'novelworldtranslations':
|
case 'novelworldtranslations':
|
||||||
bloatClasses = ['.separator img'];
|
bloatClasses = ['.separator img'];
|
||||||
@@ -366,14 +382,12 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
.each((_, el) => {
|
.each((_, el) => {
|
||||||
loadedCheerio(el).parent().remove();
|
loadedCheerio(el).parent().remove();
|
||||||
});
|
});
|
||||||
chapterTitle = loadedCheerio('.entry-title').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.entry-content')
|
loadedCheerio('.entry-title').first().text() || 'Title not found';
|
||||||
.html()!
|
chapterContent =
|
||||||
.replace(/ /g, '')
|
loadedCheerio('.entry-content').html() ||
|
||||||
.replace(/\n/g, '<br>');
|
'Content not found'.replace(/ /g, '').replace(/\n/g, '<br>');
|
||||||
if (chapterTitle && chapterContent) {
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'raeitranslations':
|
case 'raeitranslations':
|
||||||
const parts = url.split('/');
|
const parts = url.split('/');
|
||||||
@@ -391,9 +405,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
json_raei.currentChapter.note,
|
json_raei.currentChapter.note,
|
||||||
].join('');
|
].join('');
|
||||||
chapterContent = chapterContent.replace(/\n/g, '<br>');
|
chapterContent = chapterContent.replace(/\n/g, '<br>');
|
||||||
if (chapterTitle && chapterContent) {
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'rainofsnow':
|
case 'rainofsnow':
|
||||||
const displayedDiv_snow = loadedCheerio('.bb-item').filter(function () {
|
const displayedDiv_snow = loadedCheerio('.bb-item').filter(function () {
|
||||||
@@ -406,12 +418,14 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'.zoomdesc-cont p noscript',
|
'.zoomdesc-cont p noscript',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerioSnow(tag).remove());
|
bloatClasses.map(tag => loadedCheerioSnow(tag).remove());
|
||||||
chapterContent = loadedCheerioSnow('.zoomdesc-cont').html()!;
|
chapterContent =
|
||||||
|
loadedCheerioSnow('.zoomdesc-cont').html() || 'Content not found';
|
||||||
const titleElement_snow = loadedCheerioSnow('.scroller h2').first();
|
const titleElement_snow = loadedCheerioSnow('.scroller h2').first();
|
||||||
if (titleElement_snow.length) {
|
if (titleElement_snow.length) {
|
||||||
chapterTitle = titleElement_snow.text()!;
|
chapterTitle = titleElement_snow.text() || 'Title not found';
|
||||||
titleElement_snow.remove();
|
titleElement_snow.remove();
|
||||||
chapterContent = loadedCheerioSnow('.zoomdesc-cont').html()!;
|
chapterContent =
|
||||||
|
loadedCheerioSnow('.zoomdesc-cont').html() || 'Content not found';
|
||||||
if (chapterTitle && chapterContent) {
|
if (chapterTitle && chapterContent) {
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
}
|
||||||
@@ -422,7 +436,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
case 'readingpia':
|
case 'readingpia':
|
||||||
bloatClasses = ['.ezoic-ad', '.ezoic-adpicker-ad', '.ez-video-wrap'];
|
bloatClasses = ['.ezoic-ad', '.ezoic-adpicker-ad', '.ez-video-wrap'];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterText = loadedCheerio('.chapter-body').html()!;
|
chapterText = loadedCheerio('.chapter-body').html() || 'Text not found';
|
||||||
break;
|
break;
|
||||||
case 'redoxtranslation':
|
case 'redoxtranslation':
|
||||||
const chapterID_redox = url.split('/').pop();
|
const chapterID_redox = url.split('/').pop();
|
||||||
@@ -453,9 +467,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
// Join the formatted sentences back together with newline characters
|
// Join the formatted sentences back together with newline characters
|
||||||
return formattedSentences_redox.join('<br>');
|
return formattedSentences_redox.join('<br>');
|
||||||
});
|
});
|
||||||
if (chapterTitle && chapterContent) {
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'sacredtexttranslations':
|
case 'sacredtexttranslations':
|
||||||
bloatClasses = [
|
bloatClasses = [
|
||||||
@@ -464,20 +476,20 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'.reaction-buttons',
|
'.reaction-buttons',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('.entry-title').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.entry-content').html()!;
|
loadedCheerio('.entry-title').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('.entry-content').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'scribblehub':
|
case 'scribblehub':
|
||||||
bloatClasses = ['.wi_authornotes'];
|
bloatClasses = ['.wi_authornotes'];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('.chapter-title').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.chp_raw').html()!;
|
loadedCheerio('.chapter-title').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('.chp_raw').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'skydemonorder':
|
case 'skydemonorder':
|
||||||
/**
|
/**
|
||||||
@@ -489,45 +501,44 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
if (ageVerification_skydemon.includes('age verification required')) {
|
if (ageVerification_skydemon.includes('age verification required')) {
|
||||||
throw new Error('Age verification required, please open in webview.');
|
throw new Error('Age verification required, please open in webview.');
|
||||||
}
|
}
|
||||||
chapterTitle = `${loadedCheerio('.pl-4 h1').first().text()!} | ${loadedCheerio('.pl-4 div').first().text()!}`;
|
chapterTitle = `${loadedCheerio('.pl-4 h1').first().text() || 'Title not found'} | ${loadedCheerio('.pl-4 div').first().text() || 'Title not found'}`;
|
||||||
chapterContent = loadedCheerio('#startContainer + * > *')
|
chapterContent =
|
||||||
.first()
|
loadedCheerio('#startContainer + * > *').first().html() ||
|
||||||
.html()!;
|
'Content not found';
|
||||||
if (!chapterContent) {
|
if (!chapterContent) {
|
||||||
chapterContent = `${loadedCheerio('#chapter-body').html()!}<hr><br>There could be missing content, please check in webview.`;
|
chapterContent = `${loadedCheerio('#chapter-body').html() || 'Content not found'}<hr><br>There could be missing content, please check in webview.`;
|
||||||
}
|
|
||||||
if (chapterTitle && chapterContent) {
|
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
}
|
||||||
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'stabbingwithasyringe':
|
case 'stabbingwithasyringe':
|
||||||
/**
|
/**
|
||||||
* Get the chapter link from the main page
|
* Get the chapter link from the main page
|
||||||
*/
|
*/
|
||||||
const link_syringe = loadedCheerio('.entry-content a').attr('href')!;
|
const link_syringe = loadedCheerio('.entry-content a').attr('href')!;
|
||||||
const result_syringe = await fetchApi(link_syringe);
|
if (link_syringe) {
|
||||||
const body_syringe = await result_syringe.text();
|
const result_syringe = await fetchApi(link_syringe);
|
||||||
const loadedCheerio_syringe = parseHTML(body_syringe);
|
const body_syringe = await result_syringe.text();
|
||||||
|
loadedCheerio = parseHTML(body_syringe);
|
||||||
|
}
|
||||||
bloatClasses = [
|
bloatClasses = [
|
||||||
'.has-inline-color',
|
'.has-inline-color',
|
||||||
'.wp-block-buttons',
|
'.wp-block-buttons',
|
||||||
'.wpcnt',
|
'.wpcnt',
|
||||||
'#jp-post-flair',
|
'#jp-post-flair',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerio_syringe(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterContent = loadedCheerio_syringe('.entry-content').html()!;
|
chapterContent =
|
||||||
const titleElement_syringe =
|
loadedCheerio('.entry-content').html() || 'Content not found';
|
||||||
loadedCheerio_syringe('.entry-content h3').first();
|
const titleElement_syringe = loadedCheerio('.entry-content h3').first();
|
||||||
if (titleElement_syringe.length) {
|
if (titleElement_syringe.length) {
|
||||||
chapterTitle = titleElement_syringe.text();
|
chapterTitle = titleElement_syringe.text();
|
||||||
titleElement_syringe.remove();
|
titleElement_syringe.remove();
|
||||||
chapterContent = loadedCheerio_syringe('.entry-content').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.entry-content').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
} else {
|
||||||
}
|
chapterTitle = 'Title not found';
|
||||||
} else if (chapterContent) {
|
|
||||||
chapterText = chapterContent;
|
|
||||||
}
|
}
|
||||||
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'tinytranslation':
|
case 'tinytranslation':
|
||||||
bloatClasses = [
|
bloatClasses = [
|
||||||
@@ -538,32 +549,33 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'br',
|
'br',
|
||||||
];
|
];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('.title-content').first().text()!;
|
chapterTitle =
|
||||||
|
loadedCheerio('.title-content').first().text() || 'Title not found';
|
||||||
loadedCheerio('.title-content').first().remove();
|
loadedCheerio('.title-content').first().remove();
|
||||||
chapterContent = loadedCheerio('.content').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.content').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'tumblr':
|
case 'tumblr':
|
||||||
chapterText = loadedCheerio('.post').html()!;
|
chapterText = loadedCheerio('.post').html() || 'Text not found';
|
||||||
break;
|
break;
|
||||||
case 'wattpad':
|
case 'wattpad':
|
||||||
chapterTitle = loadedCheerio('.h2').first().text()!;
|
chapterTitle = loadedCheerio('.h2').first().text() || 'Title not found';
|
||||||
chapterContent = loadedCheerio('.part-content pre').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.part-content pre').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'webnovel':
|
case 'webnovel':
|
||||||
chapterTitle = loadedCheerio('.cha-tit .pr .dib').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.cha-words').html()!;
|
loadedCheerio('.cha-tit .pr .dib').first().text() ||
|
||||||
|
'Title not found';
|
||||||
|
chapterContent =
|
||||||
|
loadedCheerio('.cha-words').html() || 'Content not found';
|
||||||
if (!chapterContent) {
|
if (!chapterContent) {
|
||||||
chapterContent = loadedCheerio('._content').html()!;
|
chapterContent =
|
||||||
}
|
loadedCheerio('._content').html() || 'Content not found';
|
||||||
if (chapterTitle && chapterContent) {
|
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
|
||||||
}
|
}
|
||||||
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'wetriedtls':
|
case 'wetriedtls':
|
||||||
const scriptContent_wetried =
|
const scriptContent_wetried =
|
||||||
@@ -580,11 +592,11 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
case 'wuxiaworld':
|
case 'wuxiaworld':
|
||||||
bloatClasses = ['.MuiLink-root'];
|
bloatClasses = ['.MuiLink-root'];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle = loadedCheerio('h4 span').first().text()!;
|
chapterTitle =
|
||||||
chapterContent = loadedCheerio('.chapter-content').html()!;
|
loadedCheerio('h4 span').first().text() || 'Title not found';
|
||||||
if (chapterTitle && chapterContent) {
|
chapterContent =
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
loadedCheerio('.chapter-content').html() || 'Content not found';
|
||||||
}
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
break;
|
break;
|
||||||
case 'yoru':
|
case 'yoru':
|
||||||
const chapterId_yoru = url.split('/').pop();
|
const chapterId_yoru = url.split('/').pop();
|
||||||
@@ -595,17 +607,18 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
case 'zetrotranslation':
|
case 'zetrotranslation':
|
||||||
bloatClasses = ['hr', 'p:contains("\u00a0")'];
|
bloatClasses = ['hr', 'p:contains("\u00a0")'];
|
||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterContent = loadedCheerio('.text-left').html()!;
|
chapterContent =
|
||||||
|
loadedCheerio('.text-left').html() || 'Content not found';
|
||||||
const titleElement_zetro = loadedCheerio('.text-left h2').first();
|
const titleElement_zetro = loadedCheerio('.text-left h2').first();
|
||||||
if (titleElement_zetro.length) {
|
if (titleElement_zetro.length) {
|
||||||
chapterTitle = titleElement_zetro.text()!;
|
chapterTitle = titleElement_zetro.text() || 'Title not found';
|
||||||
titleElement_zetro.remove();
|
titleElement_zetro.remove();
|
||||||
chapterContent = loadedCheerio('.text-left').html()!;
|
chapterContent =
|
||||||
if (chapterTitle && chapterContent) {
|
loadedCheerio('.text-left').html() || 'Content not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
|
||||||
} else if (chapterContent) {
|
} else if (chapterContent) {
|
||||||
chapterTitle = loadedCheerio('.active').first().text()!;
|
chapterTitle =
|
||||||
|
loadedCheerio('.active').first().text() || 'Title not found';
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -693,6 +706,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
'asuratls',
|
'asuratls',
|
||||||
'fictionread',
|
'fictionread',
|
||||||
'helscans',
|
'helscans',
|
||||||
|
'infinitenoveltranslations',
|
||||||
'mirilu',
|
'mirilu',
|
||||||
'novelworldtranslations',
|
'novelworldtranslations',
|
||||||
'sacredtexttranslations',
|
'sacredtexttranslations',
|
||||||
@@ -745,10 +759,12 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterTitle =
|
chapterTitle =
|
||||||
loadedCheerio('.entry-title').first().text() ||
|
loadedCheerio('.entry-title').first().text() ||
|
||||||
loadedCheerio('.post-title').first().text()!;
|
loadedCheerio('.post-title').first().text() ||
|
||||||
|
'Title not found';
|
||||||
chapterContent =
|
chapterContent =
|
||||||
loadedCheerio('.entry-content').html() ||
|
loadedCheerio('.entry-content').html() ||
|
||||||
loadedCheerio('.post-body').html()!;
|
loadedCheerio('.post-body').html() ||
|
||||||
|
'Content not found';
|
||||||
if (chapterTitle && chapterContent) {
|
if (chapterTitle && chapterContent) {
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
}
|
||||||
@@ -786,7 +802,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
loadedCheerio('.wp-block-post-title').first().text() ||
|
loadedCheerio('.wp-block-post-title').first().text() ||
|
||||||
loadedCheerio('.title_story').first().text() ||
|
loadedCheerio('.title_story').first().text() ||
|
||||||
loadedCheerio('.active').first().text() ||
|
loadedCheerio('.active').first().text() ||
|
||||||
loadedCheerio('head title').first().text()!;
|
loadedCheerio('head title').first().text() ||
|
||||||
|
'Title not found';
|
||||||
const chapterSubtitle = loadedCheerio('.cat-series').first().text() || '';
|
const chapterSubtitle = loadedCheerio('.cat-series').first().text() || '';
|
||||||
if (chapterSubtitle) {
|
if (chapterSubtitle) {
|
||||||
chapterTitle = chapterSubtitle;
|
chapterTitle = chapterSubtitle;
|
||||||
@@ -806,7 +823,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
loadedCheerio('.page-body').html() ||
|
loadedCheerio('.page-body').html() ||
|
||||||
loadedCheerio('.td-page-content').html() ||
|
loadedCheerio('.td-page-content').html() ||
|
||||||
loadedCheerio('#content').html() ||
|
loadedCheerio('#content').html() ||
|
||||||
loadedCheerio('article.post').html()!;
|
loadedCheerio('article.post').html() ||
|
||||||
|
'Content not found';
|
||||||
if (chapterTitle && chapterContent) {
|
if (chapterTitle && chapterContent) {
|
||||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||||
}
|
}
|
||||||
@@ -818,7 +836,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
*/
|
*/
|
||||||
const tags = ['nav', 'header', 'footer', '.hidden'];
|
const tags = ['nav', 'header', 'footer', '.hidden'];
|
||||||
tags.map(tag => loadedCheerio(tag).remove());
|
tags.map(tag => loadedCheerio(tag).remove());
|
||||||
chapterText = loadedCheerio('body').html()!;
|
chapterText = loadedCheerio('body').html() || 'Text not found';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chapterText) {
|
if (chapterText) {
|
||||||
|
|||||||
Reference in New Issue
Block a user