Fix some novels breaking in fictionzone (#1465)

* Fix some novels breaking in fictionzone

* typescript complaining
This commit is contained in:
Adam Kemish
2025-01-27 09:53:52 +08:00
committed by GitHub
parent 50af9d7b23
commit c184ee45e5
+7 -5
View File
@@ -10,7 +10,7 @@ class FictionZonePlugin implements Plugin.PagePlugin {
name = 'Fiction Zone'; name = 'Fiction Zone';
icon = 'src/en/fictionzone/icon.png'; icon = 'src/en/fictionzone/icon.png';
site = 'https://fictionzone.net'; site = 'https://fictionzone.net';
version = '1.0.0'; version = '1.0.1';
filters: Filters | undefined = undefined; filters: Filters | undefined = undefined;
imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined; imageRequestInit?: Plugin.ImageRequestInit | undefined = undefined;
@@ -87,14 +87,15 @@ class FictionZonePlugin implements Plugin.PagePlugin {
last = a; last = a;
} }
this.cachedNovelIds.set(novelPath, last.toString()); this.cachedNovelIds.set(novelPath, last.toString());
// @ts-ignore
novel.chapters = loadedCheerio( novel.chapters = loadedCheerio(
'div.chapters > div.list-wrapper > div.items > a.chapter', 'div.chapters > div.list-wrapper > div.items > a.chapter',
) )
.map((i, el) => { .map((i, el) => {
const chapterName = loadedCheerio(el).find('span.chapter-title').text(); const chapterName = loadedCheerio(el).find('span.chapter-title').text();
const chapterUrl = loadedCheerio(el) const chapterUrl = loadedCheerio(el)
.attr('href')! .attr('href')
.replace(/^\//, '') ?.replace(/^\//, '')
.replace(/\/$/, ''); .replace(/\/$/, '');
const uploadTime = this.parseAgoDate( const uploadTime = this.parseAgoDate(
loadedCheerio(el).find('span.update-date').text(), loadedCheerio(el).find('span.update-date').text(),
@@ -103,10 +104,11 @@ class FictionZonePlugin implements Plugin.PagePlugin {
return { return {
name: chapterName, name: chapterName,
releaseTime: uploadTime, releaseTime: uploadTime,
path: chapterUrl!.replace(/^\//, '').replace(/\/$/, ''), path: chapterUrl?.replace(/^\//, '').replace(/\/$/, ''),
}; };
}) })
.toArray(); .toArray()
.filter(chap => !!chap.path);
novel.totalPages = parseInt( novel.totalPages = parseInt(
loadedCheerio('div.chapters ul.el-pager > li:last-child').text(), loadedCheerio('div.chapters ul.el-pager > li:last-child').text(),
); );