Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GalaxyAction, GalaxyManga): create & update connector #6290

Merged
merged 5 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/web/img/connectors/galaxyaction
Binary file not shown.
13 changes: 13 additions & 0 deletions src/web/mjs/connectors/GalaxyAction.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import WordPressMangastream from './templates/WordPressMangastream.mjs';

export default class GalaxyAction extends WordPressMangastream {

constructor() {
super();
super.id = 'galaxyaction';
super.label = 'Galaxy Action';
this.tags = ['webtoon', 'arabic', 'scanlation'];
this.url = 'https://galaxyaction.site';
this.path = '/manga/list-mode/';
}
}
64 changes: 59 additions & 5 deletions src/web/mjs/connectors/GalaxyManga.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,67 @@
import WordPressMangastream from './templates/WordPressMangastream.mjs';
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class GalaxyManga extends WordPressMangastream {
export default class GalaxyManga extends Connector {

constructor() {
super();
super.id = 'galaxymanga';
super.label = 'Galaxy Manga';
this.tags = ['webtoon', 'arabic'];
this.url = 'https://galaxymanga.org';
this.path = '/manga/list-mode/';
this.tags = ['webtoon', 'arabic', 'scanlation'];
this.url = 'https://flixscans.com';
this.api = 'https://api.flixscans.com';
}

async _getMangaFromURI(uri) {
const id = uri.pathname.split('-')[1];
const request = new Request(new URL(`/api/v1/webtoon/series/${id}`, this.api), this.requestOptions);
const {serie} = await this.fetchJSON(request, this.requestOptions);
return new Manga(this, serie.id, serie.title);
}

async _getMangas() {
let mangaList = [];

for (let page = 1, run = true; run; page++) {
let list = await this._getMangasFromPage(page);
list.length > 0 ? mangaList.push(...list) : run = false;
}
return mangaList;
}

async _getMangasFromPage(page) {
const request = new Request(new URL(`/api/v1/webtoon/homepage/type/manga?page=${page}`, this.api), this.requestOptions);
const { data } = await this.fetchJSON(request);

if (data.length) {
return data.map((manga) => {
return {
id: manga.id,
title: manga.title ? manga.title.trim() : null
};
});
}
return [];
}

async _getChapters(manga) {
const uri = new URL(`/api/v1/webtoon/chapters/${manga.id}-desc`, this.api);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);

return data.map((chapter) => {
return {
id: chapter.id,
title: chapter.title ? `${chapter.name} ${chapter.title.trim()}` : chapter.name
};
TristanWasTaken marked this conversation as resolved.
Show resolved Hide resolved
});
}

async _getPages(chapter) {
const uri = new URL(`/api/v1/webtoon/chapters/chapter/${chapter.id}`, this.api);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);
const images = data.chapter.chapterData.webtoon;
return images.map((image) => `${this.api}/storage/${image}`);
}
}
Loading