destruc7i0n / nani

Crunchyroll without the bloat
https://nani.ninja
MIT License
71 stars 10 forks source link

Repeatedly attempting (and failing) to access Crunchyroll leads to rate limiting from Crunchyroll blocking connections for awhile #27

Closed zlmonroe closed 4 years ago

zlmonroe commented 4 years ago

I am not sure what request is being repeated (couldn't open console during the couple seconds while request was made), but the repeated retries cause a more severe failure where Crunchyroll then blocks connections.

Stacktrace from console: Access to XMLHttpRequest at 'https://api.crunchyroll.com/start_session.0.json?access_token=LNDJgOit5yaRIWN&device_type=com.crunchyroll.windows.desktop&device_id=48b804ec-NANI-4765-9deb-4e7cb8854ea2&locale=enUS&version=1.1.21.0&connectivity_type=ethernet' from origin 'https://nani.ninja' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Error from page when directly clicking link in XHR request: Error 1015 Ray ID: 5b5b240c5d870939 • 2020-07-20 07:59:05 UTC You are being rate limited What happened? The owner of this website (api.crunchyroll.com) has banned you temporarily from accessing this website.

ITotalJustice commented 4 years ago

Were you trying to login? When i was messing around with CR api a few months ago, i'd often get rate limited for post requests. Though the only post request nani does is for auth (login and i think logout).

destruc7i0n commented 4 years ago

I suspect that you loaded up the page and then this happened after a bit? If it does not work after a bit I'd recommend clearing the cache of the site and trying again later. The authentication of the old CR api is a bit of a pain, since sessions start and end seemingly randomly. Will probably need to redo my implementation in the future.

zlmonroe commented 4 years ago

It's actually right when i open the page, I wasn't logged in and hadn't tried to. For some reason I can repro it every time now though. I just tried it again so it is currently blocking again, but I will open the console before i go to the page and record the network traffic to see if I can find the offending request. I can also try another browser to see if something in chrome on my side is weird.

zlmonroe commented 4 years ago

image nani.ninja.har.txt It looks like it was basically going through a loop of a couple different calls as soon as login occurs. I'm not sure what caused it exactly but clearing the cache fixed it (I haven't had it again for awhile) so there isn't much I can look into to figure out the original cause. At least it works now ¯_(ツ)_/¯