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';
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(),
);