Documentation

-=Documentation for the kasu.nhentaiapi.js=-

Overview
kasu.nhentaiapi.js
Json Object

CLI

Return bacc

Get started

npm i kasu.nhentaiapi.js

Basics

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.

Property classes

⠀url⠀ : string

⠀connection⠀ : object

The 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⠀ : boolean

⠀blockedWords⠀ : string

⠀ReRollonFail⠀ : boolean

⠀IgnoreNone⠀ : boolean

Method classes

⠀getID( string )⠀

⠀pRandID()⠀

⠀pRandSpecificTags( string, fn )⠀

pRand's

    ⠀pRandTag( tag, fn )⠀

    ⠀pRandParody( tag, fn )⠀

    ⠀pRandArtist( tag, fn )⠀

    ⠀pRandGroup( tag, fn )⠀

⠀pRandom( fn )⠀

⠀pHomepage( int )⠀

⠀pLanguagePage( str, int )⠀

⠀pSearch( str, int )⠀

⠀pTagPage( str, int )⠀



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"
}

Json Interface

NOTE: Some of it is literally nonsense because this is what is in the declaration file.

⠀id⠀ : number

⠀url⠀ : string

⠀title⠀ : object

⠀images⠀ : object

⠀tag_table⠀ : object

⠀favorites⠀ : number

⠀number_pages⠀ : number

⠀uploaded⠀ : string

pPage Json

This 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...
  }
]

pPage Interface

⠀CurrentUrl⠀ : string

⠀typePage⠀ : string

⠀CurrentPage⠀ : number

⠀Total⠀ : number

⠀TotalPage⠀ : number

⠀id⠀ : number

⠀title⠀ : string

⠀thumbnail⠀ : string

⠀url⠀ : string

⠀languages⠀ : string


CLI⠀prototype

![]() 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.


clicky buttons



Ichimaki Kasura
©copyright 2021