fix(french): update French sources, add J-Garden/Trad-Index/LightNovelVF, drop Phenix Scans (#2428)

Co-authored-by: Balrog57 <193098123+Balrog57@users.noreply.github.com>
This commit is contained in:
Balrog57
2026-08-16 07:42:05 +02:00
committed by GitHub
parent 632cf2ef3b
commit 4b84e48fcc
17 changed files with 1655 additions and 594 deletions
+47 -11
View File
@@ -4,20 +4,46 @@ import { Plugin } from '@/types/plugin';
import { defaultCover } from '@libs/defaultCover';
import { NovelStatus } from '@libs/novelStatus';
const challengeTitles = new Set([
'bot verification',
'you are being redirected...',
'un instant...',
'just a moment...',
'redirecting...',
]);
async function fetchCheckedHtml(
url: string,
init?: Parameters<typeof fetchApi>[1],
): Promise<string> {
const response = await fetchApi(url, init);
if (!response.ok)
throw new Error(`HTTP ${response.status} while loading ${url}`);
const html = await response.text();
const title = html
.match(/<title[^>]*>(.*?)<\/title>/is)?.[1]
?.replace(/<[^>]+>/g, '')
.replace(/\s+/g, ' ')
.trim()
.toLowerCase();
if (title && challengeTitles.has(title))
throw new Error(`Bot challenge while loading ${url}`);
return html;
}
class NovhellPlugin implements Plugin.PluginBase {
id = 'novhell';
name = 'Novhell';
icon = 'src/fr/novhell/icon.png';
site = 'https://novhell.org';
version = '1.0.1';
version = '1.0.4';
async getCheerio(url: string): Promise<CheerioAPI> {
const r = await fetchApi(url, {
headers: { 'Accept-Encoding': 'deflate' },
});
const body = await r.text();
const $ = load(body);
return $;
return load(
await fetchCheckedHtml(url, {
headers: { 'Accept-Encoding': 'deflate' },
}),
);
}
async popularNovels(pageNo: number): Promise<Plugin.NovelItem[]> {
@@ -65,7 +91,7 @@ class NovhellPlugin implements Plugin.PluginBase {
?.replace('- NovHell', '') || '';
novel.cover =
$('section div div div div div img').first().attr('src') || defaultCover;
novel.status = NovelStatus.Ongoing;
novel.status = NovelStatus.Unknown;
novel.author = $("strong:contains('Ecrit par ')")
.parent()
.text()
@@ -107,6 +133,7 @@ class NovhellPlugin implements Plugin.PluginBase {
.replace(':', '')
.trim();
const chapters: Plugin.ChapterItem[] = [];
const chapterPaths = new Set<string>();
$('main div article div div section div div div div div p a').each(
(i, elem) => {
@@ -118,6 +145,9 @@ class NovhellPlugin implements Plugin.PluginBase {
const chapterUrl = $(elem).attr('href');
// Check if the chapter URL exists and contains the site name.
if (chapterUrl && chapterUrl.includes(this.site)) {
const path = chapterUrl.replace(this.site, '');
if (chapterPaths.has(path)) return;
chapterPaths.add(path);
const regex = /Chapitre (\d+)/g;
let chapterNumber = 0;
let match;
@@ -127,7 +157,7 @@ class NovhellPlugin implements Plugin.PluginBase {
}
chapters.push({
name: chapterName,
path: chapterUrl.replace(this.site, ''),
path,
chapterNumber: chapterNumber,
});
}
@@ -170,10 +200,16 @@ class NovhellPlugin implements Plugin.PluginBase {
const chapter = sections.eq(numberOfSection - positionChapter);
if (title && chapter) {
return (title.html() || '') + (chapter.html() || '');
const content = (title.html() || '') + (chapter.html() || '');
const parsedContent = load(content);
if (
parsedContent.text().replace(/\s+/g, ' ').trim().length >= 200 ||
parsedContent('img').length
)
return content;
}
}
return '';
throw new Error('No readable chapter content found');
}
async searchNovels(