Skip to content

Commit

Permalink
add ReadAllComics and fix ComicExtra domain (#7074)
Browse files Browse the repository at this point in the history
* add ReadAllComics fix ComicExtra domain

* fix linting issues

* add copy paste support
  • Loading branch information
yoanhg421 authored May 12, 2024
1 parent 59165b1 commit 31868b5
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
Binary file added src/web/img/connectors/readallcomics
Binary file not shown.
4 changes: 2 additions & 2 deletions src/web/mjs/connectors/ComicExtra.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ComicExtra extends Connector {
super.id = 'comicextra';
super.label = 'ComicExtra';
this.tags = ['comic', 'english'];
this.url = 'https://comicextra.org';
this.url = 'https://comixextra.com';
this.path = '/comic-list/';
}

Expand All @@ -21,7 +21,7 @@ export default class ComicExtra extends Connector {
return this.getRootRelativeOrAbsoluteLink(element, request.url);
});

for(let page of pages) {
for (let page of pages) {
const mangas = await this._getMangasFromPage(page);
mangaList.push(...mangas);
}
Expand Down
55 changes: 55 additions & 0 deletions src/web/mjs/connectors/ReadAllComics.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class ReadAllComics extends Connector {
constructor() {
super();
super.id = 'readallcomics';
super.label = 'Read All Comics';
this.tags = ['comics', 'english'];
this.url = 'https://readallcomics.com';
this.requestOptions.headers.set('x-referer', this.url);
}

async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const id = uri.pathname;
const [title] = await this.fetchDOM(request, 'div.description-archive h1');
return new Manga(this, id, title.textContent.trim());
}

async _getMangas() {
let request = new Request(
this.url + '/?story=&s=&type=comic',
this.requestOptions
);
let data = await this.fetchDOM(request, 'ul.categories li a');
return data.map((element) => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim(),
};
});
}

async _getChapters(manga) {
let request = new Request(this.url + manga.id, this.requestOptions);
let data = await this.fetchDOM(request, 'ul.list-story li a');
return data.map((element) => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim(),
language: '',
};
});
}

async _getPages(chapter) {
let request = new Request(this.url + chapter.id, this.requestOptions);
let data = await this.fetchDOM(
request,
'body > center > center > div source'
);
return data.map((element) => this.getAbsolutePath(element, request.url));
}
}

0 comments on commit 31868b5

Please sign in to comment.