diff --git a/src/CoomerSu/CoomerSu.ts b/src/CoomerSu/CoomerSu.ts index e8abcee..d588217 100644 --- a/src/CoomerSu/CoomerSu.ts +++ b/src/CoomerSu/CoomerSu.ts @@ -39,7 +39,7 @@ const CSU_DOMAIN = 'https://coomer.su' const CSU_API_DOMAIN = CSU_DOMAIN + '/api/v1' export const CoomerSuInfo: SourceInfo = { - version: '1.0.0', + version: '1.0.1', name: 'CoomerSu', icon: 'icon.png', author: 'Netsky', diff --git a/src/CoomerSu/CoomerSuParser.ts b/src/CoomerSu/CoomerSuParser.ts index 62cb15f..c7f5b99 100644 --- a/src/CoomerSu/CoomerSuParser.ts +++ b/src/CoomerSu/CoomerSuParser.ts @@ -19,9 +19,9 @@ import { import { Post } from './interface/Post' -export const parseMangaDetails = async (source: any, data: Post[], mangaId: string): Promise => { +export const parseMangaDetails = async (source: any, posts: Post[], mangaId: string): Promise => { - const post = data[0] as Post + const post = posts[0] as Post const creatorData = await fetchCreatorData(source, post.user, post.service) return App.createSourceManga({ @@ -38,17 +38,18 @@ export const parseMangaDetails = async (source: any, data: Post[], mangaId: stri }) } -export const parseChapters = async (source: any, data: Post[], mangaId: string): Promise => { +export const parseChapters = async (source: any, posts: Post[], mangaId: string): Promise => { const chapters: Chapter[] = [] let sortingIndex = 0 - for (const post of data) { + for (const post of posts) { const title = `Posted ${daysAgo(post.published)} days ago` const chapterId = post.id const date: Date = post.published - const filteredAttachments = post.attachments.filter(x => !x.name.includes('.mp4')) - if (filteredAttachments.length === 0) { + const filterAttachments = post.attachments.filter(x => !x.name.includes('.mp4')) + const filteredFile = post?.file?.name?.includes('.mp4') + if (filterAttachments.length === 0 && filteredFile) { continue } @@ -77,10 +78,15 @@ export const parseChapters = async (source: any, data: Post[], mangaId: string): }) } -export const parseChapterDetails = (source: any, data: Post, mangaId: string, chapterId: string): ChapterDetails => { +export const parseChapterDetails = (source: any, post: Post, mangaId: string, chapterId: string): ChapterDetails => { const pages: string[] = [] - for (const attachment of data.attachments) { + // If the file is not an MP4, push to pages + if (!post.file.name.includes('.mp4')) { + pages.push(source.baseURL + post.file.path) + } + + for (const attachment of post.attachments) { if (!attachment.path) continue if (attachment.name.endsWith('.mp4')) continue diff --git a/src/CoomerSu/interface/Post.ts b/src/CoomerSu/interface/Post.ts index 7373c74..34e1bf0 100644 --- a/src/CoomerSu/interface/Post.ts +++ b/src/CoomerSu/interface/Post.ts @@ -9,7 +9,10 @@ export interface Post { added: Date; published: Date; edited: null; - file: any; + file: { + name: string; + path: string; + }; attachments: Attachment[]; poll: null; captions: null;