Fix some novels breaking in fictionzone (#1465)
* Fix some novels breaking in fictionzone * typescript complaining
This commit is contained in:
@@ -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(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user