Client for undocumented APIs


  • Full model (books, images, tags, comments, users).
  • Search for text query.
  • Search by tag(s).
  • Get random book.
  • Configurable hosts.
  • Support for custom Client (via package:http).
  • Out-of-box HTTP proxy support (configurable via URI).
  • Out-of-box User Agent override and Cookies support.

Notes about web usage

Using this module on web platform is experimental and has some drawbacks:

  • You can't access nhentai directly due to CORS.
    • Workaround: use CORS enabled mirror (for example you can use dev-mirror).
  • API#getRandomBook doesn't work due to limitations of XHR.
  • Proxy isn't supported on web.
  • User Agent override isn't supported.
  • Cookies helper functions aren't supported.


Import the package:

import 'package:nhentai/nhentai.dart';

Create client instance:

final api = API();

Get the data:

/// Throws if book is not found, or parse failed, see docs.
final Book book = await api.getBook(177013);

// Short book summary
  'Book: $book\n'
  'Artists: ${book.tags.artists.join(', ')}\n'
  'Languages: ${book.tags.languages.join(', ')}\n'
  'Cover: ${book.cover.getUrl(api: api)}\n'
  'First page: ${book.pages.first.getUrl(api: api)}\n'
  'First page thumbnail: ${book.pages.first.thumbnail.getUrl(api: api)}\n',

See more usage at example folder.


  • ISC License


Main library exposing API client and corresponding settings: Hosts, Host and HostType classes.
BeforeRequestCallback generator functions. that helps you to add Cookies to requests.
Data model library. It contains data models for API objects, such as Books, Tags, Images, Search response bodies and so on.
Prefixed data model library. It contains data models for API objects, such as NHentaiBooks, NHentaiTags, NHentaiImages, NHentaiSearch response bodies and so on.
Functions library.
Prefixed main library exposing NHentai client and corresponding settings: NHentaiHosts, NHentaiHost and NHentaiHostType classes.