Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nhentai not working #631

Closed
Andor233 opened this issue May 24, 2022 · 10 comments
Closed

nhentai not working #631

Andor233 opened this issue May 24, 2022 · 10 comments

Comments

@Andor233
Copy link

nhentai metafile is not working, and after doing some debugging I found that it is 503.

Is that a Cloudflare problem, or just for me?

I have a proxy(clash) on my router and it works well. No problem for ehentai or else

@Pheromir
Copy link
Contributor

nhentai is using cloudflare with the javascript challenge enabled, causing the problem.

Maybe a possible solution could be to create a login-plugin using the cloudflare cookies (depending on how long they're valid), so the js challenge gets skipped. I'm currently testing how long the cookies are valid, but as I just started today, it'll take a while I guess.

@Andor233
Copy link
Author

nhentai is using cloudflare with the javascript challenge enabled, causing the problem.

Maybe a possible solution could be to create a login-plugin using the cloudflare cookies (depending on how long they're valid), so the js challenge gets skipped. I'm currently testing how long the cookies are valid, but as I just started today, it'll take a while I guess.

So with the cookies will work? I used to want to try it but I am not familiar with Perl and HTTP.....

@Pheromir
Copy link
Contributor

So with the cookies will work? I used to want to try it but I am not familiar with Perl and HTTP.....

Seems so, yes. Without cookies I wasn't able to perform a test request using curl to (as an example) nhentai.net/api/gallery/177013, but with the cloudflare cookies (csrftoken and cf_clearance) as well as the matching User-Agent from your Webbrowser I could successfully access the api.
The cookies set in my browser have an expiry set for 1 year, but as the default expiry for cloudflare is 30minutes, the question is if they're really 1 year valid, which would be nice.

@Andor233
Copy link
Author

So with the cookies will work? I used to want to try it but I am not familiar with Perl and HTTP.....

Seems so, yes. Without cookies I wasn't able to perform a test request using curl to (as an example) nhentai.net/api/gallery/177013, but with the cloudflare cookies (csrftoken and cf_clearance) as well as the matching User-Agent from your Webbrowser I could successfully access the api. The cookies set in my browser have an expiry set for 1 year, but as the default expiry for cloudflare is 30minutes, the question is if they're really 1 year valid, which would be nice.

Will you release the login plugin? (By the way I want to know the reason of choosing perl)

@Pheromir
Copy link
Contributor

Pheromir commented May 25, 2022

Will you release the login plugin?

I'll try to create one this weekend and if it works (and the cookie expiry time is not too short) I could make a pull-request to get it merged

(By the way I want to know the reason of choosing perl)

As I'm just some random guy that discovered this software a few days ago I am not able to answer that question :(

@Difegue
Copy link
Owner

Difegue commented May 25, 2022

Making a login plugin for cloudflare would be a nice solution! (I'm guessing said CF cookies are tethered to the website that issued the challenge so the plugin would initially be NH-only, but that could be improved in time with a few backend changes)

It's likely the cookies are only valid 30 minutes no matter what, but if setting their expiry to 1y works it'd certainly make that solution much more usable.

@Difegue
Copy link
Owner

Difegue commented May 25, 2022

(By the way I want to know the reason of choosing perl)

Fun things are fun!

@Pheromir
Copy link
Contributor

It's likely the cookies are only valid 30 minutes no matter what, but if setting their expiry to 1y works it'd certainly make that solution much more usable.

I didn't change the expiry, it was added just like that. Right now, the current cookie is still valid (~17 hours) - so maybe it really is a year valid.
I'm currently modifying the EHentai.pm for nHentai, but I guess it does require a modified nhentai-metadata plugin too, as it has to use the nhentai-login data (right?)

@Difegue
Copy link
Owner

Difegue commented May 25, 2022

Awesome then!
Theoretically, there's no changes to make to the nH plugin except making it dependent on your newly-created login plugin. (depends on whether it's correctly using the mojo::useragent object provided by lrr_info for all its network requests. )

@Difegue
Copy link
Owner

Difegue commented May 26, 2022

@Pheromir 's login plugin has been added into the base pluginset of the server and should allow you to use CF cookies to get nH to work again. 🍾

@Difegue Difegue closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants