Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/multisrc/novelfire/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"options": {
"lang": "English",
"minorVer": 4,
"versionIncrement": 3
"versionIncrement": 4
}
},
{
Expand All @@ -15,7 +15,7 @@
"sourceName": "Novel Phoenix",
"options": {
"lang": "English",
"versionIncrement": 1
"versionIncrement": 2
}
}
]
19 changes: 17 additions & 2 deletions plugins/multisrc/novelfire/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Comment on lines 463 to 465
}
}

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(
Expand Down
Loading