zekfad / nhentai_dart Goto Github PK
View Code? Open in Web Editor NEWDart client for nhentai.net undocumented APIs
Home Page: https://pub.dev/packages/nhentai
License: ISC License
Dart client for nhentai.net undocumented APIs
Home Page: https://pub.dev/packages/nhentai
License: ISC License
Description:
An error can be thrown if you have reached the nhentai.net request rate limit.
Posibble solution:
Add check for nhentai.net response status code.
Debug console:
Unhandled exception:
FormatException: Unexpected character (at character 1)
<html>
^
#0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1405:5)
#1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1272:9)
#2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:937:22)
#3 _parseJson (dart:convert-patch/convert_patch.dart:40:10)
#4 JsonDecoder.convert (dart:convert/json.dart:612:36)
#5 JsonCodec.decode (dart:convert/json.dart:216:41)
#6 jsonDecode (dart:convert/json.dart:155:10)
#7 API._getJson
<asynchronous suspension>
#8 API._searchSinglePage
<asynchronous suspension>
#9 main
<asynchronous suspension>
Exited (255)
For now, to be able to use this module on web I'm using universal_io
, but it lacks support of http redirects (due to XHR
).
We can use fetch
API with manual
redirects to get this functionality, but it requires either new dedicated package or find existing with such functionality.
The pitfall here is that we have to maintain ability to use custom HttpClient
on native platforms.
I tried using the example you provided in the readme:
final api = API();
try {
/// Throws if book is not found, or parse failed, see docs.
final Book book = await api.getBook(177013);
} on ApiClientException catch (e) {
debugPrint(e.response?.statusCode.toString());
}
I seem to be getting a 403 error response. This is currently only running in a basic Dart project , no Flutter or anything else
It is making a request to https://nhentai.net/api/gallery/177013
which when visited in browser seems to work fine
there are API for tags autocompletion
When using
searchedBooks = await _api.searchSinglePage(
"*",
sort: SearchSort.popular,
page: 1,
);
I get this error API Exception: does not exist
This query does however work with all the other SearchSort options, just not with popular... Might be due to an unexpected API change?
On the nHentai home page you can see the currently popular and new uploads. It would be great if such a feature existed in in this library, an easy way to get the new and popular books
I am primarily interested in the http dependency which is quite outdated, it would be great if it could be updated to v 1.0.0 or higher. This is primarily since other projects using this dependency might run into the below:
Because nhentai 1.0.0-dev.11 depends on http ^0.13.5 and no versions of nhentai match >1.0.0-dev.11 <2.0.0, nhentai ^1.0.0-dev.11 requires http ^0.13.5.
So, because this app depends on both nhentai ^1.0.0-dev.11 and http ^1.1.0, version solving failed.
This can be an issue if http has features or security patches in later versions
Currently you have a request limit, so when calling .getBook()
too many times in too short durations, you will receive ApiClientException
. Is there a way to get a list of specific books, similar to getBook
, but for multiple books specified by their id?
splitting API
class into interface and implementation will allow external packages to implement different API client.
this is groundwork to make client based on http parsing (mostly because search is subject to multiple unclear restrictions)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.