4chan / 4chan-API

Documentation for 4chan's read-only JSON API.
http://www.4chan.org/
1.03k stars 73 forks source link

Rate Limits #101

Open ZincNitrogen opened 2 weeks ago

ZincNitrogen commented 2 weeks ago

Hi, I believe i have just gotten rate limited (axios all of a sudden gives a 429 "Too Many Requests" Error when everything was working before and there have been no changes to the code).

I read in another issue that the rate limit is 1 request per second, but I haven't been able to find that in the docs.

Does anyone know how long it takes to get unblocked?

AaronS95 commented 2 weeks ago

I'm having the same issue - no changes to my code either

It works when viewing the JSON in the browser, so it seems to be still working

ZincNitrogen commented 2 weeks ago

@AaronS95 Yeah I can also confirm the endpoint works when you go through the browser. My current plan is to essentially not make any API requests til Monday and see if I get automatically unblocked.

Hamuko commented 2 weeks ago

Are you sending a User-Agent header with your requests?

FrostyFridge commented 2 weeks ago

Don't think you're blocked, it seems like all i.c4dn requests require a User-Agent header now or else you'll get a 429

AaronS95 commented 2 weeks ago

Changed my code a bit and it seems like I was missing a User-Agent header, works fine now!

Before making any changes I logged the output of my request headers which did include User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0, so I'm not really sure what went wrong - either way it's fixed for me

ZincNitrogen commented 1 week ago

@Hamuko and @FrostyFridge , where did you find out that we need a User-Agent header?

Hamuko commented 1 week ago

Noticed that cURL worked whereas my raw HTTP requests didn't, and I knew that cURL sends its User-Agent.

ZincNitrogen commented 1 week ago

@Hamuko ah I see. Weird that 4chan made that update all of a sudden.