-=Documentation for the kasu.nhentaiapi.js=-
Return bacc
npm i kasu.nhentaiapi.js
const Example = require('kasu.nhentaiapi.js');
const ExampleApi = new Example();
/**
* or const ExampleApi = new Example('start', "https://nhentai.net");
* If you don't want to add the url and connection.start() after it.
* because it automatically start the connection.
*
* Check the documentation for more info.
*/
// ----number | strings can do----
const ID = 228922 //or "228922" or "https://nhentai.net/g/228922"
async function json(){
// start the connection
ExampleApi.url = "https://nhentai.net"
ExampleApi.connection.start()
const val = await ExampleApi.getID(ID).json()
val.url
// OR
ExampleApi.getID(ID).json(data=>{data.url})
// OR
(await ExampleApi.getID(ID).json()).url
// result: https://nhentai.net/g/228922/
// closes the connection
ExampleApi.connection.close()
}
⠀Constructor(connection, url, debug)⠀
connection
has 1 inputs that can be accepted, start. Same as the connection function below. It just automatically start the connection without calling the connection property.
url
see the url property below.
debug
see the connection's debug below.
⠀url⠀
: string.to
is now supported, The Inputted URL will be used to connect. ⠀connection⠀
: object⠀start( debug )⠀
: function⠀close( debug )⠀
: functionThe debug
on the start, close functions is a boolean.
If set to true
It will show a log that shows that it is working and connected.
⠀IsDiscord⠀
: booleanfalse
.⠀blockedWords⠀
: string blockedWords = "crossdressing brutality penetration"
⠀ReRollonFail⠀
: booleanIsDiscord
and don't wanna do your own retry function use this.false
.⠀IgnoreNone⠀
: booleanfalse
.// false
{
"tag": "none",
"parodies": "konosuba"
}
// true
{
"parodies": "konosuba"
}
⠀getID( string )⠀
string
can be a string or a number or even the link itself. Example of this method can be seen on the Basicsjson object
.⠀pRandID()⠀
⠀pRandSpecificTags( string, fn )⠀
json object
.//gets the data of the given tags
await api.pRandSpecificTags("konosuba aqua sole female", data=>{
/* data.[json object] */
})
⠀pRandTag( tag, fn )⠀
⠀pRandParody( tag, fn )⠀
⠀pRandArtist( tag, fn )⠀
⠀pRandGroup( tag, fn )⠀
json object
.//returns a link | id
await pRandtag("<name of the tag>").link | .id
//get data of the random generated ID of the given tag
await pRandtag("<name of the tag>", data=>{
/* data.[json object] */
})
⠀pRandom( fn )⠀
json object
.// gives random number
await api.pRandom()
// you can get the random number's data
await api.pRandom(data=>{
data.images.cover
})
⠀pHomepage( int )⠀
int
specifies the page. Shows the Homepage of the selected URL.json object
⠀pLanguagePage( str, int )⠀
str
only accepts 4 string japanese, english, chinese and translated (is this even a language). it also accepts shortcuts like jp, japan, eng, china. int
specifies the page.json object
⠀pSearch( str, int )⠀
str
. int
specifies the page.json object
⠀pTagPage( str, int )⠀
str
. int
specifies the page.json object
This object is also used on pRand's
data functions.
{
"id": 228922,
"url": "https://nhentai.net/g/228922/",
"title": {
"origin": "エログロス Vol.2",
"translated": "EROGROS Vol. 2",
"originFull": "[アンソロジー] エログロス Vol.2 [DL版]",
"translatedFull": "[Anthology] EROGROS Vol. 2 [Digital]"
},
"images": {
"cover": "https://t.nhentai.net/galleries/1205270/cover.jpg",
"pages_source": "https://t.nhentai.net/galleries/1205270",
"pages": [Function: pages]
},
"tag_table": {
"parodies": "none",
"characters": "none",
// bruh
"tag": "anal birth, balls expansion, big balls, big breasts, big penis, dickgirl on male, impregnation, lactation, shotacon, transformation, abortion, ahegao, amputee, bondage, cannibalism, collar, daughter, futanari, glasses, guro, human pet, lolicon, monster girl, necrophilia, piercing, pregnant, randoseru, ryona, sister, snuff, tentacles, anthology, group, incest, birth, urethra insertion, breast expansion, multiple breasts, torture, dick growth, yaoi",
"artists": "uziga waita, horihone saizou, momoiro manjiru, tksn, faith, zero punch, hayami kuro, ai7n, senmu",
"groups": "none",
"languages": "japanese",
"categories": "manga"
},
"favorites": 2900,
"number_pages": 244,
"uploaded": "2 years, 1 month ago"
}
NOTE: Some of it is literally nonsense because this is what is in the declaration file.
⠀id⠀
: number⠀url⠀
: string⠀title⠀
: object⠀origin⠀
: string⠀translated⠀
: string⠀originFull⠀
: string⠀translatedFull⠀
: string⠀images⠀
: object⠀cover⠀
: string⠀pages_source⠀
: string⠀pages⠀
: functionpage( int )
. Int
specifies the image number page.
⠀tag_table⠀
: object⠀parodies⠀
: string⠀characters⠀
: string⠀tag⠀
: string⠀artist⠀
: string⠀groups⠀
: string⠀languages⠀
: string⠀categories⠀
: string⠀favorites⠀
: number⠀number_pages⠀
: number⠀uploaded⠀
: stringThis object will show on pHomepage, pLanguagePage, pSearch, pTagPage.
// using nhentai.to for this example
[
{
"CurrentUrl": "https://nhentai.to",
"typePage": "language / japanese",
"CurrentPage": 1,
"Total": 25,
"TotalPage": 8524
},
{
"id": 374305,
"title": "[LV43 (Shia)] Onee-sama, Kore ga Hoshiino (Jinrou Judgement) [Digital]",
"thumbnail": "https://t.dogehls.xyz/galleries/2018823/thumb.jpg",
"url": "https://nhentai.to/g/374305",
"languages": "japanese"
},
{
//and more...
}
]
⠀CurrentUrl⠀
: string⠀typePage⠀
: string⠀CurrentPage⠀
: number⠀Total⠀
: number⠀TotalPage⠀
: number⠀id⠀
: number⠀title⠀
: string⠀thumbnail⠀
: string⠀url⠀
: string⠀languages⠀
: stringprototype
the CLI of the module is still WIP. You may experience weird bugs or other, Use it if you want.
nhentai
to run, add help
for options/how to.