From c184ee45e57eab83a4aea6fd6cf8942792c81632 Mon Sep 17 00:00:00 2001 From: Adam Kemish <49228220+Soopyboo32@users.noreply.github.com> Date: Mon, 27 Jan 2025 09:53:52 +0800 Subject: [PATCH] Fix some novels breaking in fictionzone (#1465) * Fix some novels breaking in fictionzone * typescript complaining --- src/plugins/english/fictionzone.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/english/fictionzone.ts b/src/plugins/english/fictionzone.ts index 92a82ab..572df30 100644 --- a/src/plugins/english/fictionzone.ts +++ b/src/plugins/english/fictionzone.ts @@ -10,7 +10,7 @@ class FictionZonePlugin implements Plugin.PagePlugin { name = 'Fiction Zone'; icon = 'src/en/fictionzone/icon.png'; site = 'https://fictionzone.net'; - version = '1.0.0'; + version = '1.0.1'; filters: Filters | undefined = undefined; imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined; @@ -87,14 +87,15 @@ class FictionZonePlugin implements Plugin.PagePlugin { last = a; } this.cachedNovelIds.set(novelPath, last.toString()); + // @ts-ignore novel.chapters = loadedCheerio( 'div.chapters > div.list-wrapper > div.items > a.chapter', ) .map((i, el) => { const chapterName = loadedCheerio(el).find('span.chapter-title').text(); const chapterUrl = loadedCheerio(el) - .attr('href')! - .replace(/^\//, '') + .attr('href') + ?.replace(/^\//, '') .replace(/\/$/, ''); const uploadTime = this.parseAgoDate( loadedCheerio(el).find('span.update-date').text(), @@ -103,10 +104,11 @@ class FictionZonePlugin implements Plugin.PagePlugin { return { name: chapterName, releaseTime: uploadTime, - path: chapterUrl!.replace(/^\//, '').replace(/\/$/, ''), + path: chapterUrl?.replace(/^\//, '').replace(/\/$/, ''), }; }) - .toArray(); + .toArray() + .filter(chap => !!chap.path); novel.totalPages = parseInt( loadedCheerio('div.chapters ul.el-pager > li:last-child').text(), );