From ed8302b1bd865e8be2c6f323284799327af6445c Mon Sep 17 00:00:00 2001 From: MikeZeDev Date: Wed, 21 Dec 2022 12:43:25 +0000 Subject: [PATCH] Add ApoloManga Fixes https://github.com/manga-download/hakuneko/issues/5017 --- src/web/mjs/connectors/ApoloManga.mjs | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/web/mjs/connectors/ApoloManga.mjs diff --git a/src/web/mjs/connectors/ApoloManga.mjs b/src/web/mjs/connectors/ApoloManga.mjs new file mode 100644 index 0000000000..1348d9143f --- /dev/null +++ b/src/web/mjs/connectors/ApoloManga.mjs @@ -0,0 +1,48 @@ +import Connector from '../engine/Connector.mjs'; +import Manga from '../engine/Manga.mjs'; +export default class ApoloManga extends Connector { + constructor() { + super(); + super.id = 'apolomanga'; + super.label = 'ApoloManga'; + this.tags = [ 'manga', 'spanish', 'webtoon', 'scanlation' ]; + this.url = 'https://apolomanga.com'; + } + async _getMangaFromURI(uri) { + const request = new Request(uri, this.requestOptions); + let id = uri.href.split('/'); + id = id[id.length-1]; + const data = await this.fetchDOM(request, 'div.titulo h1'); + return new Manga(this, id, data[0].textContent.trim()); + } + async _getMangas() { + const uri = new URL('/directorio/loads/loadMore.php', this.url); + const request = new Request(uri, this.requestOptions); + const data = await this.fetchDOM(request, 'div.proyect'); + return data.map(element => { + let id = element.getAttribute('onclick'); + id = id.match(/\/ver\/([0-9]+)/)[1]; + return { + id: id, + title: element.querySelector('div.proyect-tit').text.trim() + }; + }); + } + async _getChapters(manga) { + const uri = new URL('/ver/'+manga.id, this.url); + const request = new Request(uri, this.requestOptions); + const data = await this.fetchDOM(request, 'div.capitulos div.row > a:not([target])'); + 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.imagenes source.pagina'); + return data.map(image => this.getAbsolutePath(image, request.url)); + } +} \ No newline at end of file