forked from manga-download/hakuneko
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from MikeZeDev/MZD-dev4
merge branch 4
- Loading branch information
Showing
19 changed files
with
610 additions
and
154 deletions.
There are no files selected for viewing
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,4 @@ export default class MangaFull extends Connector { | |
callback( error, undefined ); | ||
} ); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import MangaReaderCMS from './templates/MangaReaderCMS.mjs'; | ||
|
||
export default class MangaScanWS extends MangaReaderCMS { | ||
|
||
constructor() { | ||
super(); | ||
super.id = 'mangascanws'; | ||
super.label = 'MangaScanWS'; | ||
this.tags = [ 'manga', 'webtoon', 'french' ]; | ||
this.url = 'https://mangascan.ws'; | ||
} | ||
async _getPages(chapter) { | ||
const data = await super._getPages(chapter); | ||
return data.map(element => this.createConnectorURI(element)); | ||
} | ||
async _handleConnectorURI(payload) { | ||
let request = new Request(payload, this.requestOptions); | ||
request.headers.set('x-referer', this.url); | ||
let response = await fetch(request); | ||
let data = await response.blob(); | ||
data = await this._blobToBuffer(data); | ||
this._applyRealMime(data); | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
|
||
export default class MangaTigre extends Connector { | ||
constructor() { | ||
super(); | ||
super.id = 'mangatigre'; | ||
super.label = 'MangaTigre'; | ||
this.tags = [ 'manga', 'webtoon', 'spanish' ]; | ||
this.url = 'https://www.mangatigre.net'; | ||
this.token = undefined; | ||
this.requestOptions.headers.set('x-origin', this.url); | ||
this.booktype = { | ||
1: "manga", | ||
2: "manhwa", | ||
3: "manhua", | ||
}; | ||
} | ||
|
||
async _getMangas() { | ||
const uri = new URL('/mangas', this.url); | ||
await this.getToken(uri); | ||
let mangaList = []; | ||
for (let page = 1, run = true; run; page++) { | ||
const mangas = await this._getMangasFromPage(page); | ||
mangas.length > 0 ? mangaList.push(...mangas) : run = false; | ||
} | ||
return mangaList; | ||
} | ||
|
||
async _getMangasFromPage(page) { | ||
const uri = new URL('/mangas', this.url); | ||
const request = new Request(uri, { | ||
method: 'POST', | ||
body: JSON.stringify({_token : this.token, page : page}), | ||
headers: { | ||
'content-type': 'application/json', | ||
'x-referer': uri.href | ||
} | ||
}); | ||
const response = await fetch(request); | ||
const data = await response.json(); | ||
return data.data.map(element => { | ||
let btype = this.booktype[element.type]; | ||
return { | ||
id: '/'+btype+'/'+element.slug, | ||
title: element.name.trim() | ||
}; | ||
}); | ||
} | ||
|
||
async _getChapters(manga) { | ||
const slug = manga.id.split('/')[2]; | ||
const uri = new URL(manga.id, this.url); | ||
await this.getToken(uri); | ||
const request = new Request(uri, { | ||
method: 'POST', | ||
body: JSON.stringify({_token : this.token}), | ||
headers: { | ||
'content-type': 'application/json', | ||
'x-referer': uri.href | ||
} | ||
}); | ||
const data = await this.fetchDOM(request, 'a'); | ||
return data.map(element => { | ||
return { | ||
id: element.pathname, | ||
title: element.text.trim() | ||
}; | ||
}); | ||
} | ||
|
||
async _getPages(chapter) { | ||
const uri = new URL(chapter.id, this.url); | ||
const script = ` | ||
new Promise(resolve => { | ||
resolve({ | ||
chap : window.chapter, cdn : window.cdn | ||
}); | ||
}); | ||
`; | ||
const request = new Request(uri); | ||
const response = await Engine.Request.fetchUI(request, script); | ||
const chap = JSON.parse(response.chap); | ||
const CDN = response.cdn; | ||
let keyz = Object.keys(chap.images).sort(); | ||
let pagelist = []; | ||
for (let i = 0; i < keyz.length; i++ ) { | ||
let key = keyz[i]; | ||
let image = chap.images[key]; | ||
let link = '//'.concat(CDN, '/chapters/').concat(chap.manga.slug, '/').concat(chap.number, '/').concat(image.name, '.').concat(image.format); | ||
pagelist.push(this.getAbsolutePath(link, request.url)); | ||
} | ||
return pagelist; | ||
} | ||
async getToken(url) { | ||
try{ | ||
let request = new Request(url, this.requestOptions); | ||
let data = await this.fetchDOM(request, 'button[data-token]', 3); | ||
this.token = data[0].getAttribute('data-token'); | ||
} catch(e) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
export default class ManhuaDB extends Connector { | ||
constructor() { | ||
super(); | ||
super.id = 'manhuadb'; | ||
super.label = 'ManhuaDB'; | ||
this.tags = [ 'manga', 'webtoon', 'chinese' ]; | ||
this.url = 'https://www.manhuadb.com'; | ||
this.path = '/manhua/list.html'; | ||
this.queryMangas = 'div.media.comic-book-unit div.media-body h2 > a'; | ||
this.queryMangasPagesArray = 'select#page-selector option'; | ||
this.queryChapters = 'ol.links-of-books li a'; | ||
this.queryPages = 'div.content-text source[loading="lazy"]'; | ||
this.queryMangaTitleURI = 'div.comic-main-section div.comic-info h1.comic-title'; | ||
} | ||
async _getMangaFromURI(uri) { | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchDOM(request, this.queryMangaTitleURI); | ||
return new Manga(this, uri.pathname, data[0].textContent.trim()); | ||
} | ||
async _getMangas() { | ||
let mangaList = []; | ||
const uri = new URL(this.path, this.url); | ||
const request = new Request(uri, this.requestOptions); | ||
const pagesArray = await this.fetchDOM(request, this.queryMangasPagesArray); | ||
for(let i = 0; i < pagesArray.length; i++) { | ||
const page = new URL(pagesArray[i].value, this.url); | ||
const mangas = await this._getMangasFromPage(page); | ||
mangaList.push(...mangas); | ||
} | ||
return mangaList; | ||
} | ||
async _getMangasFromPage(uri) { | ||
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.title.trim() | ||
}; | ||
}).reverse(); | ||
} | ||
async _getPages(chapter) { | ||
const uri = new URL(chapter.id, this.url); | ||
const script = ` | ||
new Promise(resolve => { | ||
resolve({ | ||
img_pre : window.img_pre, img_data_arr : window.img_data_arr , img_host : window.img_host | ||
}); | ||
}); | ||
`; | ||
const request = new Request(uri); | ||
const response = await Engine.Request.fetchUI(request, script); | ||
let pagelist = []; | ||
response.img_data_arr.forEach(image =>{ | ||
pagelist.push(response.img_host+response.img_pre +image.img); | ||
}); | ||
return pagelist; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
export default class ManhwaManga extends Connector { | ||
constructor() { | ||
super(); | ||
super.id = 'manhwamanga'; | ||
super.label = 'ManhwaManga'; | ||
this.tags = [ 'manga', 'webtoon', 'english', 'hentai' ]; | ||
this.url = 'https://manhwamanga.net'; | ||
this.path = '/latest-updates'; | ||
this.queryMangas = 'a.item-cover'; | ||
this.queryMangasPagesCount = 'ul.pagination li:last-of-type a'; | ||
this.queryChapters = 'div.episode-list div.main a'; | ||
this.queryPages = 'div#viewer source[data-src]'; | ||
this.queryMangaTitleURI = 'h1.item-title span'; | ||
} | ||
async _getMangaFromURI(uri) { | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchDOM(request, this.queryMangaTitleURI); | ||
return new Manga(this, uri.pathname, data[0].textContent.trim()); | ||
} | ||
async _getMangas() { | ||
let mangaList = []; | ||
const uri = new URL(this.path, this.url); | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchDOM(request, this.queryMangasPagesCount); | ||
const pageCount = parseInt(data[0].getAttribute('data-page')); | ||
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(this.path + '/page/'+ page, this.url); | ||
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.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, this.queryChapters); | ||
return data.map(element => { | ||
return { | ||
id: this.getRootRelativeOrAbsoluteLink(element, this.url), | ||
title: element.querySelector('b').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, this.queryPages); | ||
return data.map(image => this.getAbsolutePath(image.getAttribute('data-src'), request.url)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import WordPressLightPro from './templates/WordPressLightPro.mjs'; | ||
|
||
export default class NiceOppai extends WordPressLightPro { | ||
|
||
constructor() { | ||
super(); | ||
super.id = 'niceoppai'; | ||
super.label ='NiceOppai'; | ||
this.tags = ['manga', 'thai']; | ||
this.url = 'https://www.niceoppai.net'; | ||
this.path = '/manga_list/all/any/name-az/'; | ||
this.queryMangas = 'div.mng_lst div.nde div.det a'; | ||
this.queryChapters = 'div.mng_det ul.lst li a.lst'; | ||
this.queryPages = 'div#image-container source'; | ||
} | ||
|
||
async _getChaptersFromPage(manga, page) { | ||
const request = new Request (new URL(this.url + manga.id+ 'chapter-list/' + page), this.requestOptions); | ||
const data = await this.fetchDOM(request, this.queryChapters); | ||
return data.map(element => { | ||
return { | ||
id: this.getRelativeLink( element ), | ||
title: element.innerText.replace( manga.title, '' ).trim(), | ||
language: this.language | ||
}; | ||
}); | ||
} | ||
|
||
async _getPages(chapter) { | ||
const uri = new URL(chapter.id, this.url); | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchDOM(request, this.queryPages); | ||
return data.map(image => this.getAbsolutePath(image, request.url)); | ||
} | ||
} |
Oops, something went wrong.