Skip to content

Commit

Permalink
4 easy connectors (#5345)
Browse files Browse the repository at this point in the history
* 4 easy connectors

* Fixes #4016
* Fixes #1870
* Fixes #2335
* Fixes #3007
  • Loading branch information
MikeZeDev authored Jan 10, 2023
1 parent 23a8fb1 commit 1e5953e
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 0 deletions.
Binary file added src/web/img/connectors/mangaowlio
Binary file not shown.
Binary file added src/web/img/connectors/manhwa18cc
Binary file not shown.
Binary file added src/web/img/connectors/truyenchapvn
Binary file not shown.
13 changes: 13 additions & 0 deletions src/web/mjs/connectors/MangaOwlio.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import WordPressMadara from './templates/WordPressMadara.mjs';

export default class MangaOwlio extends WordPressMadara {

constructor() {
super();
super.id = 'mangaowlio';
super.label = 'MangaOwl.io';
this.tags = ['webtoon', 'english', 'manga' ];
this.url = 'https://mangaowl.io';
}

}
58 changes: 58 additions & 0 deletions src/web/mjs/connectors/Manhwa18cc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
import Manga from '../engine/Manga.mjs';
export default class Manhwa18cc extends WordPressMadara {
constructor() {
super();
super.id = 'manhwa18cc';
super.label = 'Manhwa 18 (.cc)';
this.tags = [ 'webtoon', 'hentai', 'multi-lingual' ];
this.url = 'https://manhwa18.cc';
this.path ='/webtoons';
this.queryMangas = 'div.manga-item div.thumb a';
this.mangaNumberPerPage = 24;
this.queryChapters ='div#chapterlist li a';
this.queryPages = 'div.read-manga div.read-content source';
}
async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div.post-title > h1');
const id = uri.pathname;
const title = data[0].textContent.replace('18+', '').trim();
return new Manga(this, id, title);
}
async _getMangas() {
let mangaList = [];
for (let page = 1, run = true; run; page++) {
let mangas = await this._getMangasFromPage(page);

//if mangalist is empty, fill it anyway
if (mangaList.length == 0 && mangas.length > 0) {
mangaList.push(...mangas);
continue;
}

//if we have no more mangas, stop right here
if (mangas.length == 0) {
run == false;
continue;
}
//now we have mangas, for sure, and mangalist not empty
//we can check for existing mangas to stop the loop or not
if (mangaList[mangaList.length - 1].id != mangas[mangas.length - 1].id) {
mangaList.push(...mangas);
} else run = false;

}
return mangaList;
}
async _getMangasFromPage(page) {
let request = new Request(new URL(this.path+'/'+page, this.url), this.requestOptions);
let data = await this.fetchDOM(request, this.queryMangas);
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, request.url),
title: element.title.trim()
};
});
}
}
17 changes: 17 additions & 0 deletions src/web/mjs/connectors/NineMangaFR.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import NineManga from './templates/NineManga.mjs';

export default class NineMangaFR extends NineManga {

constructor() {
super();
super.id = 'ninemanga-fr';
super.label = 'NineMangaFR';
this.tags = [ 'manga', 'french' ];
this.url = 'https://fr.ninemanga.com';
}

get icon() {
return '/img/connectors/ninemanga-en';
}

}
12 changes: 12 additions & 0 deletions src/web/mjs/connectors/TruyenChapVn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import FlatManga from './templates/FlatManga.mjs';

export default class TruyenChapVn extends FlatManga {

constructor() {
super();
super.id = 'truyenchapvn';
super.label = 'TruyenChap.vn';
this.tags = ['vietnamese', 'manga' ];
this.url = 'https://truyen.chap.vn';
}
}

0 comments on commit 1e5953e

Please sign in to comment.