nhentai.js-api
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

NPM downloads npm

nhentai.net api

Install

npm install nhentai.js-api

Usage

import { NHentai, NHSort } from 'nhentai.js-api';
// or
const { NHentai, NHSort } = require('nhentai.js-api');

const api = new NHentai();

// Get a hentai from a URL
const hentai = await api.hentai('https://nhentai.net/g/101010');
// Get a hentai from an id
const hentai = await api.hentai(101010);
// Get a random hentai
const hentai = await api.random(false);
// Get a random english hentai
const hentai = await api.random(true);

// Search for hentai
const results = await api.search('catgirl', NHSort.all_time);

if (results.total > 0) {
    // 25 hentai max
    for (const hentai of result.hentai) {
        console.log(
            hentai.title,
            hentai.id,
            hentai.url,
            hentai.cover,
            hentai.language
        );
        if (hentai.language === 'english') {
            const fullHentai = await hentai.fetch();
            console.log(fullHentai.images);
        }
    }

    // next page
    await results.next();
}

Read more

Package Sidebar

Install

npm i nhentai.js-api

Weekly Downloads

1

Version

3.0.3

License

ISC

Unpacked Size

30.8 kB

Total Files

9

Last publish

Collaborators

  • hubble34