From 6f2cd1b235e4aab6d64a570a24b79e403cb7c31a Mon Sep 17 00:00:00 2001 From: MikeZeDev Date: Sun, 31 Dec 2023 11:49:46 +0000 Subject: [PATCH] FIX ManhwaLatino : mangalist and chapters (#6409) * FIX ManhwaLatino : mangalist and chapters Fixes https://github.com/manga-download/hakuneko/issues/6408 * remove junk pages * add referer for images --- src/web/mjs/connectors/ManhwaLatino.mjs | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/web/mjs/connectors/ManhwaLatino.mjs b/src/web/mjs/connectors/ManhwaLatino.mjs index 9840356cfda..90504038043 100644 --- a/src/web/mjs/connectors/ManhwaLatino.mjs +++ b/src/web/mjs/connectors/ManhwaLatino.mjs @@ -8,5 +8,36 @@ export default class ManhwaLatino extends WordPressMadara { super.label = 'Manhwa-Latino'; this.tags = [ 'webtoon', 'hentai', 'spanish' ]; this.url = 'https://manhwa-latino.com'; + this.requestOptions.headers.set('x-referer', this.url); + + } + + _createMangaRequest(page) { + return new Request(new URL(`/manga/page/${page}/`, this.url), this.requestOptions); + } + + async _getChapters(manga) { + const uri = new URL(manga.id, this.url); + const request = new Request(uri, this.requestOptions); + const data = await this.fetchDOM(request, 'li.wp-manga-chapter div.mini-letters > a'); + return data.map(element => { + return { + id: this.getRootRelativeOrAbsoluteLink(element, this.url), + title: element.text.trim() + }; + }); + } + + async _getPages(chapter) { + const uri = new URL(chapter.id, this.url); + const request = new Request(uri, this.requestOptions); + const data = await this.fetchDOM(request, 'div.page-break source.img-responsive'); + return data.map(image => { + const payload = { + url : image.getAttribute('data-src'), + referer : request.url + }; + return this.createConnectorURI(payload); + }); } -} \ No newline at end of file +}