Skip to content

Commit

Permalink
Add ApoloManga
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeZeDev authored Dec 21, 2022
1 parent 3a0305d commit ed8302b
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/web/mjs/connectors/ApoloManga.mjs
Original file line number Diff line number Diff line change
@@ -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));
}
}

0 comments on commit ed8302b

Please sign in to comment.