feat: [Novel Updates]: Update Site Detection (#1187)
* novel-updates: add Daoist Quest * novel-updates: fix * novel-updates: remove lazy-loaded images and add new css * novel-updates: text-align in unordered lists * novel-updates: enhance css * novel-updates: remove clip-path * novel-updates: update bg color * novel-updates: update * novel-updates: revert version * novel-updates: update Blogspot and WordPress detection * novel-updates: fix * novel-updates: update * novel-updates: revert version * novel-updates: fix * novel-updates: update * novel-updates: revert version
This commit is contained in:
@@ -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.7';
|
version = '0.7.8';
|
||||||
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/';
|
||||||
@@ -665,36 +665,45 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
/**
|
/**
|
||||||
* Detect if the site is a Blogspot site
|
* Detect if the site is a Blogspot site
|
||||||
*/
|
*/
|
||||||
const isBlogspotStr =
|
const blogspotSources = [
|
||||||
loadedCheerio('meta[name="google-adsense-platform-domain"]').attr(
|
loadedCheerio('meta[name="google-adsense-platform-domain"]').attr(
|
||||||
'content',
|
'content',
|
||||||
) || loadedCheerio('meta[name="generator"]').attr('content');
|
),
|
||||||
let isBlogspot = false;
|
loadedCheerio('meta[name="generator"]').attr('content'),
|
||||||
if (isBlogspotStr) {
|
];
|
||||||
isBlogspot =
|
|
||||||
isBlogspotStr.toLowerCase().includes('blogspot') ||
|
const blogspotKeywords = ['blogspot', 'blogger'];
|
||||||
isBlogspotStr.toLowerCase().includes('blogger');
|
let isBlogspot = blogspotSources.some(
|
||||||
}
|
source =>
|
||||||
|
source &&
|
||||||
|
blogspotKeywords.some(keyword =>
|
||||||
|
source.toLowerCase().includes(keyword),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if the site is a WordPress site
|
* Detect if the site is a WordPress site
|
||||||
*/
|
*/
|
||||||
const isWordPressStr =
|
const wordpressSources = [
|
||||||
loadedCheerio('#dcl_comments-js-extra').html() ||
|
loadedCheerio('#dcl_comments-js-extra').html(),
|
||||||
loadedCheerio('meta[name="generator"]').attr('content') ||
|
loadedCheerio('meta[name="generator"]').attr('content'),
|
||||||
loadedCheerio('footer').text()!;
|
loadedCheerio('.powered-by').text(),
|
||||||
let isWordPress = false;
|
loadedCheerio('footer').text(),
|
||||||
if (isWordPressStr) {
|
];
|
||||||
isWordPress =
|
|
||||||
isWordPressStr.toLowerCase().includes('wordpress') ||
|
const wordpressKeywords = ['wordpress', 'site kit by google'];
|
||||||
isWordPressStr.includes('Site Kit by Google') ||
|
let isWordPress = wordpressSources.some(
|
||||||
loadedCheerio('.powered-by').text().toLowerCase().includes('wordpress');
|
source =>
|
||||||
}
|
source &&
|
||||||
|
wordpressKeywords.some(keyword =>
|
||||||
|
source.toLowerCase().includes(keyword),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In case sites are not detected correctly
|
* In case sites are not detected correctly
|
||||||
*/
|
*/
|
||||||
const manualWordPress = ['genesistls', 'soafp'];
|
const manualWordPress = ['etherreads', 'soafp'];
|
||||||
if (!isWordPress && domain.find(wp => manualWordPress.includes(wp))) {
|
if (!isWordPress && domain.find(wp => manualWordPress.includes(wp))) {
|
||||||
isWordPress = true;
|
isWordPress = true;
|
||||||
}
|
}
|
||||||
@@ -810,8 +819,12 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
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() ||
|
||||||
|
loadedCheerio('h1.leading-none ~ h2').first().text() ||
|
||||||
'Title not found';
|
'Title not found';
|
||||||
const chapterSubtitle = loadedCheerio('.cat-series').first().text() || '';
|
const chapterSubtitle =
|
||||||
|
loadedCheerio('.cat-series').first().text() ||
|
||||||
|
loadedCheerio('h1.leading-none ~ span').first().text() ||
|
||||||
|
'';
|
||||||
if (chapterSubtitle) {
|
if (chapterSubtitle) {
|
||||||
chapterTitle = chapterSubtitle;
|
chapterTitle = chapterSubtitle;
|
||||||
}
|
}
|
||||||
@@ -829,6 +842,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
|||||||
loadedCheerio('.content').html() ||
|
loadedCheerio('.content').html() ||
|
||||||
loadedCheerio('.page-body').html() ||
|
loadedCheerio('.page-body').html() ||
|
||||||
loadedCheerio('.td-page-content').html() ||
|
loadedCheerio('.td-page-content').html() ||
|
||||||
|
loadedCheerio('.reader-content').html() ||
|
||||||
loadedCheerio('#content').html() ||
|
loadedCheerio('#content').html() ||
|
||||||
loadedCheerio('article.post').html()!;
|
loadedCheerio('article.post').html()!;
|
||||||
if (chapterTitle && chapterContent) {
|
if (chapterTitle && chapterContent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user