Fix(plugin): novhell (#982)
* Fix novhell * fix * fix unnecessary assignment
This commit is contained in:
@@ -10,7 +10,7 @@ class NovhellPlugin implements Plugin.PluginBase {
|
|||||||
name = 'Novhell';
|
name = 'Novhell';
|
||||||
icon = 'src/fr/novhell/icon.png';
|
icon = 'src/fr/novhell/icon.png';
|
||||||
site = 'https://novhell.org';
|
site = 'https://novhell.org';
|
||||||
version = '1.0.0';
|
version = '1.0.1';
|
||||||
filters: Filters | undefined = undefined;
|
filters: Filters | undefined = undefined;
|
||||||
|
|
||||||
async getCheerio(url: string): Promise<CheerioAPI> {
|
async getCheerio(url: string): Promise<CheerioAPI> {
|
||||||
@@ -165,10 +165,20 @@ class NovhellPlugin implements Plugin.PluginBase {
|
|||||||
const sections = $('main article div div section');
|
const sections = $('main article div div section');
|
||||||
if (sections) {
|
if (sections) {
|
||||||
const numberOfSection = sections.length;
|
const numberOfSection = sections.length;
|
||||||
const title = sections.eq(numberOfSection - 3);
|
let title;
|
||||||
const chapitre = sections.eq(numberOfSection - 2);
|
let positionChapter = 2;
|
||||||
if (title && chapitre) {
|
|
||||||
return (title.html() || '') + (chapitre.html() || '');
|
for (let i = 3; i <= 5; i++) {
|
||||||
|
title = sections.eq(numberOfSection - i);
|
||||||
|
if (title.find('h4').length !== 0) {
|
||||||
|
positionChapter = i - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const chapter = sections.eq(numberOfSection - positionChapter);
|
||||||
|
|
||||||
|
if (title && chapter) {
|
||||||
|
return (title.html() || '') + (chapter.html() || '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
|||||||
Reference in New Issue
Block a user