diff --git a/plugins/multisrc/novelfire/sources.json b/plugins/multisrc/novelfire/sources.json index fe106ad11..826f71c15 100644 --- a/plugins/multisrc/novelfire/sources.json +++ b/plugins/multisrc/novelfire/sources.json @@ -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 } } ] diff --git a/plugins/multisrc/novelfire/template.ts b/plugins/multisrc/novelfire/template.ts index 9b9d0f13f..3b47f2440 100644 --- a/plugins/multisrc/novelfire/template.ts +++ b/plugins/multisrc/novelfire/template.ts @@ -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(