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
2 changes: 1 addition & 1 deletion 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": 4
"versionIncrement": 5
}
},
{
Expand Down
14 changes: 13 additions & 1 deletion plugins/multisrc/novelfire/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,19 @@ export class NovelFirePlugin implements Plugin.PagePlugin {

async parseChapter(chapterPath: string): Promise<string> {
const url = this.site + chapterPath;
const loadedCheerio = await this.getCheerio(url, false);
let loadedCheerio = await this.getCheerio(url, false);

// Chapters may redirect to a mirror (e.g. readnovel.site) that serves a
// "Loading..." page and forwards via JavaScript. Follow that redirect.
if (loadedCheerio('#content').length === 0) {
const redirect = loadedCheerio('script')
.text()
.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
if (redirect) {
const target = redirect[1].replace(/\\\//g, '/');
loadedCheerio = await this.getCheerio(target, false);
}
}

const chapterText = loadedCheerio('#content');

Expand Down
Loading