Hi, I've created a front-end application that directly consumes the TMDB api.
In this application, I have an array of strings that correspond to a simple list of movie names.
So I wanted to make a for loop via this array, to retrieve the data from this url
https://api.themoviedb.org/3/search/tv?query=${query}
I got this error: “Too many requests”. (Makes sense...)
I'd like to know how I can go about avoiding this, as I haven't found a solution in the document.
لم تجد الفلم أو المسلسل ؟ سجل دخولك و انشئها
هل تريد تقييم او اضافة هذا العنصر للقائمة؟
لست عضو؟
رد بواسطة noodlecat
بتاريخ يوليو 18, 2024 في 9:09 مساءا
may be the request too fast so that cause the error,you can use 'setTimeout' function to delay these request
رد بواسطة ticao2 🇧🇷 pt-BR
بتاريخ يوليو 19, 2024 في 10:34 صباحا
Perhaps the following will help resolve your issue.
API Request Limits
First we have this information in the instructions for using the TMDb API.
https://developer.themoviedb.org/docs/rate-limiting
And Travis Bell, the Administrator, has already given us this explanation.
For API Requests:
See here: https://www.themoviedb.org/talk/62c7c1b258361b005fd2e747?page=1#62c83b78befd91005007a0c7
For Images:
See here:
https://www.themoviedb.org/talk/62edd3ca46aed400917de201#62ee88e7176a940086449cdf
https://www.themoviedb.org/talk/62c7c1b258361b005fd2e747?page=1#6301a107097c49007f60374a
https://www.themoviedb.org/talk/62c7c1b258361b005fd2e747
And...
Is there really no API Rate Limiting?
See here:
https://www.themoviedb.org/talk/6442ced4d35dea02fcfb0fab#6442d4a0d35dea0455fb1a07
In this link I believe you can see your volume of API Requests.https://www.themoviedb.org/sessionرد بواسطة Travis Bell
بتاريخ يوليو 19, 2024 في 11:22 صباحا
@ticao2 that request count is only for the website, it doesn't relate to the API in any way.
@noodlecat The easiest way to help with your issue is it to introduce a small delay in between every requests so that you are issuing more than ~40 per second. There are fancier designs where you can keep track of the number of requests in a second, and then limit the number you execute within a threshold of sorts. It's really up to you how you want to implement this.
رد بواسطة Maxime145
بتاريخ يوليو 21, 2024 في 10:15 صباحا
Thanks for your answers !
The “delay” solution doesn't work for me because it's impractical to deal with single-call errors. What's more, I get around 120 calls every time I refresh my page.
I ended up making a back application with rudimentary cache management. And on the front-end, I simply send the names to be retrieved. This reduces the number of calls to the TMDB API.