diff --git a/dist/providers/manga/asurascans.js b/dist/providers/manga/asurascans.js index f8207b3a0..5cb96c245 100644 --- a/dist/providers/manga/asurascans.js +++ b/dist/providers/manga/asurascans.js @@ -37,16 +37,6 @@ class AsuraScans extends models_1.MangaParser { .find('.space-y-1.pt-4 > div > button') .map((index, ele) => $(ele).text().trim()) .get(), - chapters: dom - .find('.pl-4.pr-2.pb-4.overflow-y-auto > div') - .map((index, ele) => { - return { - id: $(ele).find('h3:nth-child(1) > a').attr('href'), - title: $(ele).find('h3:nth-child(1) > a').text().trim(), - releaseDate: $(ele).find('h3:nth-child(2)').text().trim(), - }; - }) - .get(), recommendations: dom .find('.grid.grid-cols-2.gap-3.p-4 > a') .map((index, ele) => { @@ -61,6 +51,20 @@ class AsuraScans extends models_1.MangaParser { }) .get(), }; + const chapMatch = data + .replace(/\n/g, '') + .replace(/\\/g, '') + .match(/"chapters".*:(\[\{.*?\}\]),/); + if (chapMatch) { + const chap = JSON.parse(chapMatch[1]); + info.chapters = chap.map((ele) => { + return { + id: ele.name, + title: ele.title != '' ? ele.title : `Chapter ${ele.name}`, + releaseDate: ele.published_at, + }; + }); + } return info; } catch (err) { @@ -70,18 +74,14 @@ class AsuraScans extends models_1.MangaParser { this.fetchChapterPages = async (chapterId) => { try { const { data } = await this.client.get(`${this.baseUrl}/series/${chapterId}`); - const $ = (0, cheerio_1.load)(data); - const dom = $('html'); - const pages = dom - .find('.w-full.mx-auto.center > img') - .map((index, ele) => { - return { - img: $(ele).attr('src'), - page: index + 1, - }; - }) - .get(); - return pages; + const chapMatch = data.replace(/\\/g, '').match(/pages.*:(\[{['"]order["'].*?}\])/); + if (!chapMatch) + throw new Error('Parsing error'); + let chap = JSON.parse(chapMatch[1]); + return chap.map((page, index) => ({ + page: index + 1, + img: page.url, + })); } catch (err) { throw new Error(err.message); diff --git a/dist/providers/manga/asurascans.js.map b/dist/providers/manga/asurascans.js.map index e798d7bd5..b83db57d9 100644 --- a/dist/providers/manga/asurascans.js.map +++ b/dist/providers/manga/asurascans.js.map @@ -1 +1 @@ -{"version":3,"file":"asurascans.js","sourceRoot":"","sources":["../../../src/providers/manga/asurascans.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAE3C,yCAQsB;AAGtB,MAAM,UAAW,SAAQ,oBAAW;IAApC;;QACoB,SAAI,GAAG,YAAY,CAAC;QACnB,YAAO,GAAG,wBAAwB,CAAC;QACnC,SAAI,GAAG,wCAAwC,CAAC;QAChD,cAAS,GAAG,kBAAkB,CAAC;QAEzC,mBAAc,GAAG,KAAK,EAAE,OAAe,EAAuB,EAAE;YACvE,IAAI,CAAC;gBACH,MAAM,EAAE,IAAI,EAAE,GAAkB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC;gBACpF,MAAM,CAAC,GAAe,IAAA,cAAI,EAAC,IAAI,CAAC,CAAC;gBAEjC,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;gBAExE,MAAM,IAAI,GAAe;oBACvB,EAAE,EAAE,OAAO;oBACX,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE;oBAChE,KAAK,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;oBAChD,MAAM,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE;oBACvE,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAC9B,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CACrG;oBACD,WAAW,EAAE,GAAG,CA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Z,OAAO,oBAAW,CAAC,OAAO,CAAC;YAC7B,KAAK,SAAS;gBACZ,OAAO,oBAAW,CAAC,SAAS,CAAC;YAC/B;gBACE,OAAO,oBAAW,CAAC,OAAO,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"asurascans.js","sourceRoot":"","sources":["../../../src/providers/manga/asurascans.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAE3C,yCAQsB;AAGtB,MAAM,UAAW,SAAQ,oBAAW;IAApC;;QACoB,SAAI,GAAG,YAAY,CAAC;QACnB,YAAO,GAAG,wBAAwB,CAAC;QACnC,SAAI,GAAG,wCAAwC,CAAC;QAChD,cAAS,GAAG,kBAAkB,CAAC;QAEzC,mBAAc,GAAG,KAAK,EAAE,OAAe,EAAuB,EAAE;YACvE,IAAI,CAAC;gBACH,MAAM,EAAE,IAAI,EAAE,GAAkB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC;gBACpF,MAAM,CAAC,GAAe,IAAA,cAAI,EAAC,IAAI,CAAC,CAAC;gBAEjC,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;gBACtB,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;gBAExE,MAAM,IAAI,GAAe;oBACvB,EAAE,EAAE,OAAO;oBACX,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE;oBAChE,KAAK,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;oBAChD,MAAM,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE;oBACvE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AAO,GAAG,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC,CAAC;IAcJ,CAAC;IAZS,mBAAmB,CAAC,KAAa;QACvC,QAAQ,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YACnC,KAAK,WAAW;gBACd,OAAO,oBAAW,CAAC,SAAS,CAAC;YAC/B,KAAK,SAAS;gBACZ,OAAO,oBAAW,CAAC,OAAO,CAAC;YAC7B,KAAK,SAAS;gBACZ,OAAO,oBAAW,CAAC,SAAS,CAAC;YAC/B;gBACE,OAAO,oBAAW,CAAC,OAAO,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAED,kBAAe,UAAU,CAAC"} \ No newline at end of file diff --git a/src/providers/manga/asurascans.ts b/src/providers/manga/asurascans.ts index f32a2adcd..43ba52631 100644 --- a/src/providers/manga/asurascans.ts +++ b/src/providers/manga/asurascans.ts @@ -49,16 +49,6 @@ class AsuraScans extends MangaParser { .find('.space-y-1.pt-4 > div > button') .map((index, ele) => $(ele).text().trim()) .get(), - chapters: dom - .find('.pl-4.pr-2.pb-4.overflow-y-auto > div') - .map((index, ele): IMangaChapter => { - return { - id: $(ele).find('h3:nth-child(1) > a').attr('href') as string, - title: $(ele).find('h3:nth-child(1) > a').text().trim(), - releaseDate: $(ele).find('h3:nth-child(2)').text().trim(), - }; - }) - .get(), recommendations: dom .find('.grid.grid-cols-2.gap-3.p-4 > a') .map((index, ele): IMangaResult => { @@ -74,6 +64,22 @@ class AsuraScans extends MangaParser { .get(), }; + const chapMatch = data + .replace(/\n/g, '') + .replace(/\\/g, '') + .match(/"chapters".*:(\[\{.*?\}\]),/); + if (chapMatch) { + const chap: { name: string; title: string; id: string; published_at: string }[] = JSON.parse( + chapMatch[1] + ); + info.chapters = chap.map((ele): IMangaChapter => { + return { + id: ele.name, + title: ele.title != '' ? ele.title : `Chapter ${ele.name}`, + releaseDate: ele.published_at, + }; + }); + } return info; } catch (err) { throw new Error((err as Error).message); @@ -83,20 +89,15 @@ class AsuraScans extends MangaParser { override fetchChapterPages = async (chapterId: string): Promise => { try { const { data }: AxiosResponse = await this.client.get(`${this.baseUrl}/series/${chapterId}`); - const $: CheerioAPI = load(data); - - const dom = $('html'); - const pages = dom - .find('.w-full.mx-auto.center > img') - .map((index, ele): IMangaChapterPage => { - return { - img: $(ele).attr('src') as string, - page: index + 1, - }; + const chapMatch = data.replace(/\\/g, '').match(/pages.*:(\[{['"]order["'].*?}\])/); + if (!chapMatch) throw new Error('Parsing error'); + const chap: { order: string; url: string }[] = JSON.parse(chapMatch[1]); + return chap.map( + (page, index): IMangaChapterPage => ({ + page: index + 1, + img: page.url, }) - .get(); - - return pages; + ); } catch (err) { throw new Error((err as Error).message); }