Skip to content

Commit

Permalink
Add Pururin and many Madara websites (#5149)
Browse files Browse the repository at this point in the history
* Add Pururin

* Add MangaHereToday

* Add MangaFoxFull 

* Add MadaraDex 

* Add MangaChill 

* Add Webcomic.me 

* Add ManhuaDragon 

* Add Manhuadragon 

* Add painfulnightz 

* Add Manga1st
  • Loading branch information
MikeZeDev authored and Sheepux committed Mar 26, 2023
1 parent f73f0bc commit a87eea1
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 21 deletions.
Binary file added src/web/img/connectors/madaradex
Binary file not shown.
Binary file added src/web/img/connectors/manga1st
Binary file not shown.
Binary file added src/web/img/connectors/mangachill
Binary file not shown.
Binary file added src/web/img/connectors/mangafoxfull
Binary file not shown.
Binary file added src/web/img/connectors/mangaheretoday
Binary file not shown.
Binary file added src/web/img/connectors/manhuadragon
Binary file not shown.
Binary file added src/web/img/connectors/painfulnightz
Binary file not shown.
Binary file added src/web/img/connectors/webcomicme
Binary file not shown.
24 changes: 24 additions & 0 deletions src/web/mjs/connectors/MadaraDex.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class MadaraDex extends WordPressMadara {
constructor() {
super();
super.id = 'madaradex';
super.label = 'MadaraDex';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://madaradex.org';
this.requestOptions.headers.set('x-referer', this.url);
}
async _handleConnectorURI(payload) {
let request = new Request(payload.url, this.requestOptions);
request.headers.set('x-sec-fetch-dest', 'image');
request.headers.set('accept', 'image/avif,image/webp,*/*');
request.headers.set('x-sec-fetch-mode', 'no-cors');
request.headers.set('Upgrade-Insecure-Requests', 1);
request.headers.set('x-user-agent', 'Mozilla/5.0 (iPod; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.163 Mobile/15E148 Safari/604.1');
let response = await fetch(request);
let data = await response.blob();
data = await this._blobToBuffer(data);
this._applyRealMime(data);
return data;
}
}
10 changes: 10 additions & 0 deletions src/web/mjs/connectors/Manga1st.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class Manga1st extends WordPressMadara {
constructor() {
super();
super.id = 'manga1st';
super.label = 'Manga1st';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://manga1st.com';
}
}
10 changes: 10 additions & 0 deletions src/web/mjs/connectors/MangaChill.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class MangaChill extends WordPressMadara {
constructor() {
super();
super.id = 'mangachill';
super.label = 'MangaChill';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://mangachill.io';
}
}
11 changes: 11 additions & 0 deletions src/web/mjs/connectors/MangaFoxFull.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class MangaFoxFull extends WordPressMadara {
constructor() {
super();
super.id = 'mangafoxfull';
super.label = 'MangaFoxFull';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://mangafoxfull.com';
this.requestOptions.headers.set('x-referer', this.url);
}
}
26 changes: 26 additions & 0 deletions src/web/mjs/connectors/MangaHereToday.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import AnyACG from './templates/AnyACG.mjs';
import Manga from '../engine/Manga.mjs';

export default class MangaHereToday extends AnyACG {
constructor() {
super();
super.id = 'mangaheretoday';
super.label = 'MangaHereToday';
this.tags = [ 'manga', 'english' ];
this.url = 'http://mangahere.today';
this.queryMangas = 'div.row div.media-body';
this.queryMangaLink = 'a';
this.queryChapters = 'div.total-chapter:nth-of-type(4) h4 a';
this.queryPages = 'div.chapter-content-inner p#arraydata';
this.queryMangaTitle = 'div.media-body';
this.queryMangaTitleText = 'h1.title-manga';
}
async _getMangaFromURI(uri) {
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, this.queryMangaTitle);
let id = uri.pathname + uri.search;
//HACK We need to remove trailing "Manga" from the title
let title = data[0].querySelector(this.queryMangaTitleText).textContent.replace(/\s+Manga$/i, '').trim();
return new Manga(this, id, title);
}
}
10 changes: 10 additions & 0 deletions src/web/mjs/connectors/ManhuaDragon.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class ManhuaDragon extends WordPressMadara {
constructor() {
super();
super.id = 'manhuadragon';
super.label = 'ManhuaDragon';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://manhuadragon.com';
}
}
10 changes: 10 additions & 0 deletions src/web/mjs/connectors/PainfulNightz.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class PainfulNightz extends WordPressMadara {
constructor() {
super();
super.id = 'painfulnightz';
super.label = 'PainfulNightz';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://painfulnightz.com';
}
}
91 changes: 70 additions & 21 deletions src/web/mjs/connectors/Pururin.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,80 @@
import Connector from '../engine/Connector.mjs';

/**
*
*/
import Manga from '../engine/Manga.mjs';
export default class Pururin extends Connector {

/**
*
*/
constructor() {
super();
super.id = 'pururin';
super.label = 'Pururin';
this.tags = [];
this.url = 'https://pururin.io';
this.links = {
login: 'https://pururin.io/login'
};
this.tags = ['manga', 'hentai', 'english'];
this.url = 'https://pururin.to';
this.CDN = "https://cdn.pururin.to/assets/images/data/";
this.path = "/browse/title";
this.api = "/api/contribute/gallery/info";
this.queryMangasPageCount = 'ul.pagination.flex-wrap li:nth-last-of-type(2) a';
this.queryMangas = 'a.card.card-gallery';
this.queryChapters ='div.gallery-action a';
this.requestOptions.headers.set('x-referer', this.url);
this.requestOptions.headers.set('x-origin', this.url);
}
async _getMangas() {
let mangaList = [];
const uri = new URL(this.path, this.url);
const request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, this.queryMangasPageCount);
let pageCount = parseInt(data[0].text);
for(let page = 1; page <= pageCount; page++) {
let mangas = await this._getMangasFromPage(page);
mangaList.push(...mangas);
}
return mangaList;
}
async _getMangasFromPage(page) {
let uri = new URL(this.path + '?page='+page, this.url);
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, this.queryMangas);
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, request.url),
title: element.querySelector('source.card-img-top').getAttribute('alt').trim()
};
});
}

_getMangaList( callback ) {
callback( new Error( 'Please report this broken website on HakuNeko\'s GitHub project page.' ), undefined );
async _getChapters(manga) {
return [{ id: manga.id, title: 'Chapter' }];
}
_getChapterList( manga, callback ) {
callback( new Error( 'Please report this broken website on HakuNeko\'s GitHub project page.' ), undefined );
async _getPages(chapter) {
let mangaID = chapter.id.match(/\/gallery\/([0-9]+)/)[1];
const uri = new URL(this.api, this.url);
const request = this.getApiRequest(uri, mangaID);
const data = await this.fetchJSON(request);
let pagesMax = data.gallery.total_pages;
let extension = data.gallery.image_extension;
//https://cdn.pururin.to/assets/images/data/<mangaid>/<i>.image_extension
return new Array(pagesMax).fill().map((_, index) => new URL(`${this.CDN}/${mangaID}/${index + 1}.${extension}`).href);
}
_getPageList( manga, chapter, callback ) {
callback( new Error( 'Please report this broken website on HakuNeko\'s GitHub project page.' ), undefined );
async _getMangaFromURI(uri) {
let mangaID = uri.href.match(/\/gallery\/([0-9]+)/)[1];
const req = new URL(this.api, this.url);
const request = this.getApiRequest(req, mangaID);
const data = await this.fetchJSON(request);
const title = data.gallery.title;
const id = this.getRootRelativeOrAbsoluteLink(uri, this.url);
return new Manga(this, id, title);
}
getApiRequest(url, id) {
let params = {
id: id,
type:2
};
return new Request(url, {
method: 'POST',
body: JSON.stringify(params),
headers: {
'x-origin': this.url,
'x-referer': this.url,
'Content-Type': 'application/json;charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
}
});
}
}
}
10 changes: 10 additions & 0 deletions src/web/mjs/connectors/Webcomicme.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WordPressMadara from './templates/WordPressMadara.mjs';
export default class WebComicMe extends WordPressMadara {
constructor() {
super();
super.id = 'webcomicme';
super.label = 'WebComic (Webcomic.me)';
this.tags = [ 'manga', 'webtoon', 'english' ];
this.url = 'https://webcomic.me';
}
}

0 comments on commit a87eea1

Please sign in to comment.