Giter VIP home page Giter VIP logo

nhentai_dart's Issues

Unhandled exception while parsing response.

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)

web: redirects

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.

403 (Forbidden) error on data request

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

SearchSort.popular causes does not exist error

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?

Feature Request: Get popular and new books

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

Update to use newer dependencies

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

Get multiple specific books at a time

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?

make API an interface with implementation

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.