nhentai
v4.0.0
Published
A library for interacting with the nhentai API
Readme
Installing
$ npm install nhentai --no-optional
$ pnpm install nhentai --no-optional
$ yarn install nhentai --no-optionalUsage
// CommonJS
const nhentai = require('nhentai');
// ES6/Typescript
import * as nhentai from "nhentai";
const api = new nhentai.API();
api.fetchDoujin(334430).then(doujin => {
// Keijun Yahagi wa Koi o Shita. Jou | Light Cruiser Yahagi Fell In Love - First
doujin.titles.pretty;
// https://i.nhentai.net/galleries/1767063/1.jpg
doujin.pages[0].url;
// https://t.nhentai.net/galleries/1767063/cover.jpg
doujin.cover.url;
// english, translated, kantai collection, teitoku, yahagi, rosapersica, [etc...]
doujin.tags.all.map(tag => tag.name).join(', ');
});If you encounter frequent Cloudflare challenges (especially on search requests), you will likely need to set up a Flaresolverr-compatible API proxy in order to proxy this library's requests through it to the nhentai API.
const api = new nhentai.API({
flaresolverrUrl: "http://localhost:8081/v1", // URL to selfhosted FlareSolverr API
});This feature also requires the npm package htmlparser2 as an optional dependency of this library.
