دعم الموقع

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.

4 ردود (على هذه الصفحة 1 من 1)

Jump to last post

may be the request too fast so that cause the error,you can use 'setTimeout' function to delay these request

@Maxime145 said:
Too many requests
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.

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:

One of our CDN providers enforces some base level rate limiting to help prevent DDOS attacks.
I believe it's a maximum of:
50 requests per second and
20 connections per IP.

See here: https://www.themoviedb.org/talk/62c7c1b258361b005fd2e747?page=1#62c83b78befd91005007a0c7

For Images:

For image.tmdb.org the only thing we limit is the max number of simultaneous connections.
The limit is the same, 20.

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?

The original rate limiting (40 requests every 10 seconds) has indeed been been disabled since December 2019.
There are some higher overall limits that still exists to help mitigate different attacks and the like.
I believe they sit around the 50 request per second range.

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

@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.

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.

لم تجد الفلم أو المسلسل ؟ سجل دخولك و انشئها

عام

s ركز شريط البحث
p افتح قائمة الملف الشخصي
esc اغلق النافذة المفتوحة
? افتح نافذة اختصارات لوحة المفاتيح

على كافة صفحات الوسائط

b ارجع للخلف (او للصفحة الام عند التطبيق)
e انتقل لصفحة التعديل

على كافة صفحات موسم المسلسل

(السهم الايمن) انتقل للموسم التالي
(السهم الايسر) انتقل للموسم السابق

على كافة صفحات حلقة المسلسل

(السهم الايمن) انتقل للحلقة التالية
(السهم الايسر) انتقل للحلقة السابقة

على كافة صفحات الصور

a افتح صفحة اضافة الصورة

على كافة صفحات التعديل

t افتح محدد الترجمة
ctrl+ s ارسال النموذج

على صفحات المناقشة

n انشى نقاش جديد
w تبديل حالة المتابعة
p تبديل عام / خاص
c تبديل اغلاق / فتح
a افتح الانشطة
r رد على النقاش
l انتقل لأخر رد
ctrl+ enter أرسل رسالتك
(السهم الايمن) الصفحة التالية
(السهم الايسر) الصفحة السابقة

الاعدادات

هل تريد تقييم او اضافة هذا العنصر للقائمة؟

تسجيل الدخول