The Movie Database-ondersteuning

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 antwoorden (op pagina 1 van 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.

Film of tv-serie niet gevonden? Meld je aan om deze toe te voegen.

Wereldwijd

s focus op zoekbalk
p open profielmenu
esc sluit een open venster
? open sneltoetsen venster

Op media pagina's

b ga terug (of ga naar bovenliggend item)
e ga naar beweken

Op tv-seizoenspagina's

(rechter pijl) ga naar volgende seizoen
(linker pijl) ga naar vorig seizoen

Op pagina's met tv-series

(rechter pijl) ga naar volgende aflevering
(linker pijl) ga naar vorige aflevering

Op alle afbeeldingspagina's

a open venster afbeelding toevoegen

Op alle bewerkte pagina's

t open vertaalmenu
ctrl+ s verstuur formulier

Op discussiepagina's

n start nieuwe discussie
w Verander kijk status
p privé of openbaar
c schakelen sluiten/openen
a open activiteit
r beantwoord discussie
l ga naar laatste antwoord
ctrl+ enter verstuur uw bericht
(rechter pijl) volgende pagina
(linker pijl) vorige pagina

Instellingen

Want to rate or add this item to a list?

Inloggen