nhentai-api is a Node.JS client library designed for interacting with the undocumented APIs of nhentai.net. Currently at version 3.4.3, the library exhibits an active release cadence, with recent minor updates addressing type fixes and introducing new features such as `getRandomBook`. It provides an objective-oriented API abstraction, facilitating tasks like bidirectional inspection (e.g., retrieving an image from a book or a book from an image). A key differentiating feature is its built-in support for proxies, allowing users to configure custom agents for requests, enhancing flexibility and privacy. The library focuses on returning structured data from the nhentai.net API and provides direct URLs for binary content like images. It also offers advanced search functionalities and helper methods for filtering and managing various tag types. The package ships with comprehensive TypeScript types, significantly improving developer experience and type safety.
npm install nhentai-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the nhentai API client, fetches a specific book by ID, retrieves a random book, performs a search query, and demonstrates iterating through search results using an async generator. It logs key information like book titles, image URLs, and tag details.
Consult the official GitHub repository for a complete list of breaking changes and migration guides when upgrading across major versions.
Ensure your `nhentai-api` package is updated to version `3.4.1` or higher to utilize the `getRandomBook` functionality.
For production applications, consider using more recent patch versions of the `3.x` series (e.g., `3.4.x`) that have likely incorporated bug fixes and improved stability.
For CommonJS, use `const { API } = require('nhentai-api');`. For ES Modules, use `import { API } from 'nhentai-api';`.Update your `nhentai-api` package to version `3.4.1` or newer using `npm update nhentai-api` or `yarn upgrade nhentai-api`.
Validate the book ID, implement exponential backoff for rate limiting (429), or wrap API calls in `try/catch` blocks to handle network/API errors gracefully.
No dependency data recorded yet.