Skip to content

Commit

Permalink
Merge pull request #11 from MikeZeDev/MZD-dev7
Browse files Browse the repository at this point in the history
merge branch 7
  • Loading branch information
MikeZeDev authored Nov 24, 2024
2 parents 38db6ad + 5adcd90 commit 106579e
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 0 deletions.
Binary file added src/web/img/connectors/comicastle
Binary file not shown.
Binary file added src/web/img/connectors/hentaivnvip
Binary file not shown.
Binary file added src/web/img/connectors/novelbin
Binary file not shown.
Binary file added src/web/img/connectors/readlightnovel
Binary file not shown.
Binary file added src/web/img/connectors/travistranslation
Binary file not shown.
56 changes: 56 additions & 0 deletions src/web/mjs/connectors/ComiCastle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';
export default class ComiCastle extends Connector {
constructor() {
super();
super.id = 'comicastle';
super.label = 'ComiCastle';
this.tags = [ 'comics', 'english' ];
this.url = 'https://comicastle.org';
this.pages = 'abcdefghijklmnopqrstuvwxyz';
this.path = '/library/az/';
}
async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const id = uri.pathname + uri.search;
const title = (await this.fetchDOM(request, '.nomeserie span'))[0].textContent.trim();
return new Manga(this, id, title);
}
async _getMangas() {
let mangas = [];
for (let i = 0; i < this.pages.length; i++ ) {
const request = new Request(new URL(this.path+this.pages[i], this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.table-responsive a:not([class])');
mangas.push(...data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}));
}
const request = new Request(new URL(this.path+'sy', this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.table-responsive a:not([class])');
mangas.push(...data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}));
return mangas;
}
async _getChapters(manga) {
const request = new Request(new URL(manga.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'table.table.zero-configuration a');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}).reverse();
}
async _getPages(chapter) {
const request = new Request(new URL(chapter.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div#read-pbp select option');
return data.map (element => element.getAttribute('alt').trim());
}
}
60 changes: 60 additions & 0 deletions src/web/mjs/connectors/HentaiVnVip.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class HentaiVnVip extends Connector {

constructor() {
super();
super.id = 'hentaivnvip';
super.label = 'HentaiVnVip';
this.tags = [ 'manga', 'vietnamese, hentai' ];
this.url = 'https://hentaivnhot.net';
}

async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div.info h1.name');
return new Manga(this, uri.pathname, data[0].textContent.trim());
}
async _getMangas() {
let mangaList = [];
const uri = new URL('/truyen-hentai-moi/', this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'a:nth-last-of-type(2).page-numbers');
const pageCount = parseInt(data[0].text);
for(let page = 1; page <= pageCount; page++) {
const mangas = await this._getMangasFromPage(page);
mangaList.push(...mangas);
}
return mangaList;
}
async _getMangasFromPage(page) {
const uri = new URL('/truyen-hentai-moi/page/' + page, this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div.entry > a.name');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.title.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, 'div.chap-list a');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.querySelector('span.name').textContent.trim()
};
});
}
async _getPages(chapter) {
const uri = new URL(chapter.id, this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div.content-text source[loading="lazy"]');
return data.map(image => this.getAbsolutePath(image, request.url));
}
}
18 changes: 18 additions & 0 deletions src/web/mjs/connectors/MangaWorldAdult.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import MangaWorld from './MangaWorld.mjs';

export default class MangaWorldAdult extends MangaWorld {

constructor() {
super();
super.id = 'mangaworldadult';
super.label = 'MangaWorldAdult';
this.tags = ['manga', 'webtoon', 'italian', 'hentai'];
this.url = 'https://mangaworldadult.com';
}
canHandleURI(uri) {
return /https?:\/\/(?:www\.)?mangaworldadult.com/.test(uri.origin);
}
get icon() {
return '/img/connectors/mangaworld';
}
}
95 changes: 95 additions & 0 deletions src/web/mjs/connectors/NovelBin.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class NovelBin extends Connector {

constructor() {
super();
super.id = 'novelbin';
super.label = 'NovelBin';
this.tags = [ 'novel', 'english' ];
this.url = 'https://novelbin.com';
this.novelFormat = 'image/png';
this.novelWidth = '56em'; // parseInt(1200 / window.devicePixelRatio) + 'px';
this.novelPadding = '1.5em';

}
async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'h3.title');
return new Manga(this, uri.pathname, data[0].textContent.trim());
}
async _getMangas() {
let mangaList = [];
const uri = new URL('/sort/latest-free/', this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'ul.pagination li:last-of-type a');
const pageCount = parseInt(data[0].href.match(/(\d)+$/)[1]);
for(let page = 1; page <= pageCount; page++) {
const mangas = await this._getMangasFromPage(page);
mangaList.push(...mangas);
}
return mangaList;
}

async _getMangasFromPage(page) {
const uri = new URL('/sort/latest-free?page=' + page, this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'h3.novel-title > a');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
});
}

async _getChapters(manga) {
let slug = manga.id.split('/');
slug = slug[slug.length-1];
const request = new Request(new URL('/ajax/chapter-archive?novelId='+slug, this.url), this.requestOptions);
request.headers.set('X-Requested-With', 'XMLHttpRequest');

const data = await this.fetchDOM(request, 'ul.list-chapter li a');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.querySelector('span').textContent.trim()
};
}).reverse();
}
async _getPages(chapter) {
const request = new Request(new URL(chapter.id, this.url), this.requestOptions);
let darkmode = Engine.Settings.NovelColorProfile();
let script = `
new Promise((resolve, reject) => {
document.body.style.width = '${this.novelWidth}';
let container = document.querySelector('div.row');
container.style.maxWidth = '${this.novelWidth}';
container.style.padding = '0';
container.style.margin = '0';
let novel = document.querySelector('div#chr-content');
novel.style.padding = '${this.novelPadding}';
[...novel.querySelectorAll(":not(:empty)")].forEach(ele => {
ele.style.backgroundColor = '${darkmode.background}'
ele.style.color = '${darkmode.text}'
})
novel.style.backgroundColor = '${darkmode.background}'
novel.style.color = '${darkmode.text}'
let script = document.createElement('script');
script.onerror = error => reject(error);
script.onload = async function() {
try{
let canvas = await html2canvas(novel);
resolve(canvas.toDataURL('${this.novelFormat}'));
}catch (error){
reject(error)
}
}
script.src = 'https://html2canvas.hertzen.com/dist/html2canvas.min.js';
document.body.appendChild(script);
});
`;
return [ await Engine.Request.fetchUI(request, script, 30000, true) ];
}
}
90 changes: 90 additions & 0 deletions src/web/mjs/connectors/Readlightnovel.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';
export default class Readlightnovel extends Connector {
constructor() {
super();
super.id = 'readlightnovel';
super.label = 'Readlightnovel.me';
this.tags = [ 'novel', 'english' ];
this.url = 'https://readlightnovel.me';
this.pages = 'abcdefghijklmnopqrstuvwxyz';
this.path = '/novel-list-rln/';
this.novelFormat = 'image/png';
this.novelWidth = '56em'; // parseInt(1200 / window.devicePixelRatio) + 'px';
this.novelPadding = '1.5em';
}
async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const id = uri.pathname + uri.search;
const title = (await this.fetchDOM(request, '.nomeserie span'))[0].textContent.trim();
return new Manga(this, id, title);
}
async _getMangas() {
let mangas = [];
for (let i = 0; i < this.pages.length; i++ ) {
const request = new Request(new URL(this.path+this.pages[i], this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.list-by-word-body ul li a');
mangas.push(...data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}));
}
const request = new Request(new URL(this.path, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.list-by-word-body ul li a');
mangas.push(...data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}));
return mangas;
}
async _getChapters(manga) {
const request = new Request(new URL(manga.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.panel-body li a');
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.text.trim()
};
}).reverse();
}
async _getPages(chapter) {
const request = new Request(new URL(chapter.id, this.url), this.requestOptions);
let darkmode = Engine.Settings.NovelColorProfile();
let script = `
new Promise((resolve, reject) => {
document.body.style.width = '${this.novelWidth}';
let container = document.querySelector('div#ch-page-container');
container.style.maxWidth = '${this.novelWidth}';
container.style.padding = '0';
container.style.margin = '0';
let novel = document.querySelector('div#growfoodsmart.hidden');
novel.className = '';
novel.style.padding = '${this.novelPadding}';
[...novel.querySelectorAll(":not(:empty)")].forEach(ele => {
ele.style.backgroundColor = '${darkmode.background}'
ele.style.color = '${darkmode.text}'
})
novel.style.backgroundColor = '${darkmode.background}'
novel.style.color = '${darkmode.text}'
let script = document.createElement('script');
script.onerror = error => reject(error);
script.onload = async function() {
try{
let canvas = await html2canvas(novel);
resolve(canvas.toDataURL('${this.novelFormat}'));
}catch (error){
reject(error)
}
}
script.src = 'https://html2canvas.hertzen.com/dist/html2canvas.min.js';
document.body.appendChild(script);
});
`;
return [ await Engine.Request.fetchUI(request, script, 30000, true) ];
}
}
Loading

0 comments on commit 106579e

Please sign in to comment.