NovelFire Empty Chapter fix (#2462)

This commit is contained in:
Vaibhav
2026-08-24 09:06:20 +05:30
committed by GitHub
parent 5e08dfe542
commit e1dcd06a47
2 changed files with 19 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
"options": {
"lang": "English",
"minorVer": 4,
"versionIncrement": 3
"versionIncrement": 4
}
},
{
@@ -15,7 +15,7 @@
"sourceName": "Novel Phoenix",
"options": {
"lang": "English",
"versionIncrement": 1
"versionIncrement": 2
}
}
]
+17 -2
View File
@@ -449,17 +449,32 @@ export class NovelFirePlugin implements Plugin.PagePlugin {
const loadedCheerio = await this.getCheerio(url, false);
const chapterText = loadedCheerio('#content');
if (chapterText.length === 0) {
throw new Error(
`Chapter content container (#content) not found for ${chapterPath} — possible transient fetch issue. Retry`,
);
}
const odds = chapterText.find(
':not(p, h1, span, i, b, u, img, a, div, strong)',
);
for (const ele of odds.toArray()) {
const tag = ele.name.toString();
if (tag.length > 5 && ele.name.toString().substring(0, 1) == 'nf') {
if (tag.length > 5 && tag.substring(0, 1) == 'nf') {
loadedCheerio(ele).remove();
}
}
return chapterText.html()?.replace(/ /g, ' ') || '';
const html = chapterText.html()?.replace(/ /g, ' ');
if (!html || html.trim().length === 0) {
throw new Error(
`Chapter content was empty after parsing for ${chapterPath}.`,
);
}
return html;
}
async searchNovels(