diff --git a/plugins/multisrc/novelfire/sources.json b/plugins/multisrc/novelfire/sources.json index 826f71c15..e58eb2afb 100644 --- a/plugins/multisrc/novelfire/sources.json +++ b/plugins/multisrc/novelfire/sources.json @@ -6,7 +6,7 @@ "options": { "lang": "English", "minorVer": 4, - "versionIncrement": 4 + "versionIncrement": 5 } }, { diff --git a/plugins/multisrc/novelfire/template.ts b/plugins/multisrc/novelfire/template.ts index 3b47f2440..e9811587f 100644 --- a/plugins/multisrc/novelfire/template.ts +++ b/plugins/multisrc/novelfire/template.ts @@ -446,7 +446,19 @@ export class NovelFirePlugin implements Plugin.PagePlugin { async parseChapter(chapterPath: string): Promise { 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');