Skip to content

Commit

Permalink
add OremangaNet.mjs (#6443)
Browse files Browse the repository at this point in the history
* Add OremangaNet.mjs

Add file OremangaNet.mjs

* Update OremangaNet.mjs

Sort the code correctly.

* Update OremangaNet.mjs

* Add Logo Oremanga

Add file logo Oremanga

* Delete src/web/img/connectors/Oremanga

* Add file logo oremanga

---------

Co-authored-by: MikeZeDev <MikeZeDev@users.noreply.github.com>
  • Loading branch information
YainuWan11 and MikeZeDev authored Nov 21, 2023
1 parent 33d2197 commit d4f1e97
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
Binary file added src/web/img/connectors/oremanga
Binary file not shown.
57 changes: 57 additions & 0 deletions src/web/mjs/connectors/OremangaNet.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class OremangaNet extends Connector {

constructor() {
super();
super.id = 'oremanga';
super.label = 'Oremanga';
this.tags = [ 'manga', 'webtoon', 'thai' ];
this.url = 'https://www.oremanga.net';
this.path = '/manga-list/';
this.queryMangas = 'div.mangalist-blc ul li a.series';
this.queryChapters = 'ul.series-chapterlist li div.flexch-infoz a';
this.queryPages = 'div.reader-area source';
this.queryMangaTitle = 'div.series-title h2';
}

async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, this.queryMangaTitle);
const id = uri.pathname;
const title = data[0].textContent.trim();
return new Manga(this, id, title);
}

async _getMangas() {
const request = new Request(new URL(this.path, this.url), this.requestOptions);
const data = await this.fetchDOM(request, this.queryMangas);
return data.map(element => {
return{
id: this.getRelativeLink( element ),
title: element.text.trim()
};
});
}

async _getChapters(manga) {
const request = new Request(new URL(manga.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, this.queryChapters);
return data.map(element => {
const titleElement = element.querySelector('span');
const bloat = titleElement.querySelector('.date');
if (bloat) titleElement.removeChild(bloat);
return{
id: this.getRelativeLink( element ),
title: element.querySelector('span').textContent.trim()
};
});
}

async _getPages(chapter) {
const request = new Request(new URL(chapter.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, this.queryPages);
return data.map(element => this.getRootRelativeOrAbsoluteLink(element, this.url));
}
}

0 comments on commit d4f1e97

Please sign in to comment.