https://github.com/zekfad/nhentai_dart
Dart client for nhentai.net undocumented APIs
https://github.com/zekfad/nhentai_dart
api api-client dart dart-package doujin hentai nhentai nhentai-api
Last synced: 11 months ago
JSON representation
Dart client for nhentai.net undocumented APIs
- Host: GitHub
- URL: https://github.com/zekfad/nhentai_dart
- Owner: Zekfad
- License: isc
- Created: 2022-01-18T21:16:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-26T23:24:27.000Z (almost 2 years ago)
- Last Synced: 2025-04-04T03:11:35.200Z (over 1 year ago)
- Topics: api, api-client, dart, dart-package, doujin, hentai, nhentai, nhentai-api
- Language: Dart
- Homepage: https://pub.dev/packages/nhentai
- Size: 112 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Client for nhentai.net undocumented APIs
## Features
* 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`](https://pub.dev/packages/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](https://github.com/Zekfad/dev-mirror)).
* `API#getRandomBook` doesn't work due to limitations of `XHR`.
* Workaround: use
[`package:fetch_client`](https://pub.dev/packages/fetch_client).
* Proxy isn't supported on web.
* User Agent override isn't supported on web.
* Cookies helper functions aren't supported on web.
## Usage
Import the package:
```dart
import 'package:nhentai/nhentai.dart';
```
Create client instance:
```dart
final api = API();
```
Get the data:
```dart
/// Throws if book is not found, or parse failed, see docs.
final Book book = await api.getBook(421025);
// Short book summary
print(
'Book: $book\n'
'Artists: ${book.tags.artists.join(', ')}\n'
'Languages: ${book.tags.languages.join(', ')}\n'
'Cover: ${api.hosts.getImageUrl(book.cover)}\n'
'First page: ${api.hosts.getImageUrl(book.pages.first)}\n'
'First page thumbnail: ${api.hosts.getImageUrl(book.pages.first.thumbnail)}',
);
```
See more usage at [example](example/) folder.
## License
* ISC License