chirag-droid / animeflix

A anime discovery, streaming site made with NextJs and TailwindCSS. Uses AniList API and video data from GogoAnime. No ads and no vpn required
GNU Affero General Public License v3.0
490 stars 191 forks source link

Anilist's Ratelimit #184

Open hoangvu12 opened 2 years ago

hoangvu12 commented 2 years ago

Describe the bug Anilist does limit the API for 90 requests per minute, I notice that you're using getServerSideProps, have you ever facing the problem that the server can't fetch the data due to ratelimit?

To Reproduce Steps to reproduce the behavior: Just go to some anime page over and over until the server reaches anilist's ratelimit. (I guess)?

Expected behavior Some workarounds to avoid the anilist's ratelimit

Additional context We could use CSR for this, but we can't SEO if using CSR and that's the huge pay-off.

chirag-droid commented 2 years ago

We can use incremental server side generation with revalidating cache every 5min or 10min. But this will only work with homepage I think.

chirag-droid commented 2 years ago

If you are hosting this for your own use, then it should be fine ig.

otherwise you can ask anilist to increase your ratelimit by giving them the ip address of the server. This depends on how the project is deployed.

hoangvu12 commented 2 years ago

We can use incremental server side generation with revalidating cache every 5min or 10min. But this will only work with homepage I think.

Sure we could do that, also one thing that I didn't mention, if you send multiple requests that happens too fast, you'll get rate limit too, so I think you could wait a few seconds (2.5 seconds must be an ideal time) to avoid that.

image