diff --git a/src/AsuraScans/AsuraScans.ts b/src/AsuraScans/AsuraScans.ts index c159ba5..c985976 100644 --- a/src/AsuraScans/AsuraScans.ts +++ b/src/AsuraScans/AsuraScans.ts @@ -48,7 +48,7 @@ const ASURASCANS_DOMAIN = 'https://asuracomic.net' const ASURASCANS_API_DOMAIN = 'https://gg.asuracomic.net' export const AsuraScansInfo: SourceInfo = { - version: '4.2.0', + version: '4.2.1', name: 'AsuraScans', description: 'Extension that pulls manga from AsuraScans', author: 'Seyden', @@ -343,7 +343,9 @@ export class AsuraScans implements ChapterProviding, HomePageSectionsProviding, const chapterLink: string = await this.getChapterSlug(mangaId, chapterId) const url: string = await this.getBaseUrl() const data = await this.loadRequestData(`${url}/${chapterLink}/`) - return this.parser.parseChapterDetails(data, mangaId, chapterId) + const $ = this.cheerio.load(data) + + return this.parser.parseChapterDetails($, mangaId, chapterId) } async getSearchTags(): Promise { diff --git a/src/AsuraScans/AsuraScansParser.ts b/src/AsuraScans/AsuraScansParser.ts index df1b0f0..462cb44 100644 --- a/src/AsuraScans/AsuraScansParser.ts +++ b/src/AsuraScans/AsuraScansParser.ts @@ -154,19 +154,19 @@ export class AsuraScansParser { }) } - parseChapterDetails(data: string, mangaId: string, chapterId: string): ChapterDetails { - const pages = new Set() + parseChapterDetails($: CheerioStatic, mangaId: string, chapterId: string): ChapterDetails { + const pages: string[] = [] - const matches = data.matchAll(/(https:\/\/gg\.asuracomic\.net\/storage\/comics\/[^"\\]+)/gi) - for (const match of Array.from(matches)) { - const url = (match[1] ?? '').replace(' ', '%20') - pages.add(url) + for (const img of $('img', 'div.py-8.-mx-5').toArray()) { + const image = $(img).attr('src') ?? '' + if (!image) continue + pages.push(image.trim()) } return App.createChapterDetails({ id: chapterId, mangaId, - pages: [...pages] + pages: pages }) }