-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add NHentai.Com Fixes #2308 * Add files via upload
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,38 @@ | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
|
||
export default class NHentaiCom extends Connector { | ||
|
||
constructor() { | ||
super(); | ||
super.id = 'nhentaicom'; | ||
super.label = 'NHentai.Com'; | ||
this.tags = [ 'hentai' ]; | ||
this.url = 'https://nhentai.com'; | ||
} | ||
|
||
async _getMangas() { | ||
let msg = 'This website provides a manga list that is to large to scrape, please copy and paste the URL containing the images directly from your browser into HakuNeko.'; | ||
throw new Error(msg); | ||
} | ||
|
||
async _getChapters(manga) { | ||
return [ Object.assign({language: '' }, manga) ]; | ||
} | ||
|
||
async _getPages(chapter) { | ||
const uri = new URL(`/api/comics/${chapter.id}/images`, this.url); | ||
const request = new Request(uri, this.requestOptions); | ||
const data = await this.fetchJSON(request); | ||
return data.images.map(el => { | ||
return el.source_url; | ||
}); | ||
} | ||
|
||
async _getMangaFromURI(uri) { | ||
const slug = uri.pathname.split('/').pop(); | ||
const request = new Request(new URL(`/api/comics/${slug}`, this.url), this.requestOptions); | ||
const data = await this.fetchJSON(request); | ||
return new Manga(this, data.slug, data.title); | ||
} | ||
} |