Skip to content

Commit

Permalink
[KissmangaORG] add website support (#2581)
Browse files Browse the repository at this point in the history
* [KissmangaORG] add website support

* fixes
  • Loading branch information
manh21 authored and ronny1982 committed Nov 14, 2020
1 parent 6f247ba commit 5475051
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
Binary file added src/web/img/connectors/kissmangaorg
Binary file not shown.
69 changes: 69 additions & 0 deletions src/web/mjs/connectors/KissmangaORG.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class KissmangaORG extends Connector {

constructor() {
super();
super.id = 'kissmangaorg';
super.label = 'Kissmanga.org';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://kissmanga.org';
this.path = '/manga_list/';

this.queryMangas = 'div.listing div.item_movies_in_cat div a.item_movies_link';
this.queryChapters = 'div#leftside div.full div.episodeList div.full div.listing.full div div h3 a';
this.queryPages = 'div.barContent div.full div.full.watch_container div#centerDivVideo source';
this.queryMangaTitle = 'div.bigBarContainer div.barContent div.full h2';
}

async _getMangas() {
let mangaList = [];
for(let page = 1, run = true; run; page++) {
let mangas = await this._getMangasFromPage(page);
mangas.length ? mangaList.push(...mangas) : run = false;
}
return mangaList;
}

async _getMangasFromPage(page) {
const uri = new URL(this.path, this.url);
uri.searchParams.set('page', page);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, this.queryMangas);
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
});
}

async _getChapters(manga) {
const uri = new URL(manga.id, this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, this.queryChapters);
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.replace(manga.title + ' -', '').trim()
};
});
}

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

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);
}

}

0 comments on commit 5475051

Please sign in to comment.