nhentai 1.0.0-dev.9 nhentai: ^1.0.0-dev.9 copied to clipboard
Client for nhentai.net undocumented APIs written in Dart.
Client for nhentai.net undocumented APIs #
Features #
- Full model (books, images, tags).
- Search for text query.
- Search by tag(s).
- Get random book.
- Configurable hosts.
- Support custom
HttpClient
. - Drop-in HTTP proxy support (configurable by URI).
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 ofXHR
.- Proxy doesn't supported on web.
Usage #
Import the package:
import 'package:nhentai/nhentai.dart';
Create client instance:
final api = API();
Get the data:
final Book? book = await api.getBook(177013);
if (book == null)
throw Exception('Something went wrong.');
// Short book summary
print(
'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.
License #
- ISC License