calne-ca / nhentai-java-client

Java client for nhentai
MIT License
2 stars 1 forks source link

Not working anymore :) #1

Closed MdKaif2782 closed 2 years ago

MdKaif2782 commented 2 years ago

buddy ..your api url 'https://nhentai.net/api/galleries/{code}' isn't returning json anymore ..Its checking the browser before returning the json :)

please fix it

calne-ca commented 2 years ago

NHentai is currently playing around with CloudFlare's anti-bot challenge feature. Since the API this clients uses is not really official (there is no official API) this also applies to the API, which usually shouldn't be the case for APIs. This is not an issue specific to this client, other clients face the same issue as well. Currently, there is only FlareSolverr that could resolve those challenges, but it's not really easy to integrate that with a Java library. I'm facing the same issue when using HDoujin Downloader even with FlareSolverr. I opened an issue about that here.

So, for now I can't immediately fix this. I hope that NHentai will revert their changes again but I'll also try to find a solution for this. Can't promise anything though.

calne-ca commented 2 years ago

It works again. Apparently NHentai disabled the cloudflare anti-bot challenge again. Of course they can always enable it again.

I didn't find any solution to solve this on library side. For a stand-alone application you could solve this by integrating with solutions like FlareSolverr, but these solutions are based headless browsers which are used as proxies. This cannot easily be integrated with a Java library. So if nHentai does this again I'm afraid I can't really fix this atm.

The only thing I could do is add FlareSolverr integration to this library, but FlareSolverr itself would still need to be run by the user. So the user would be required to run a FlareSolverr instance before this library can be used. Of course this is not always possible and also not really convenient. But unless nHentai will publish an official API or keeps the anti-bot challenge disabled for good this is probably the only way to address these anti-bot challenges.

MdKaif2782 commented 2 years ago

Yuhh‌!! Checked this evening It's working again! Hope they publish the Official api soon before enabling the cloudflare bot challenge again.. Anyway resolved for now at least.. I'm also finding ways to bypass cloudflare bot challenge