The Movie Database-ondersteuning

I am writing an application in Perl to display movies released in the last week. I have the code working, but it's slow. I call the API with discover/movie to get all the newly released movies, and then call the API with movie/{id}/releases for each of the movies so I can extract only movies with US releases. This code takes about 10 seconds. Then I call the API with movie/{id} to get basic information about each of the movies. This portion takes about 13 seconds. So, to get a complete list of US-released movies for one week takes about 23 seconds (depending on how many movies were released that week). This is obviously slow. If I want to use the API for this purpose, is it expected that I write code to download the entire database, update the data periodically, and access the data locally?

1 antwoord (op pagina 1 van 1)

Jump to last post

Hi celiao,

A few things.

Use ?append_to_response so you only have to make the movie call with releases once. That's half as many calls as you're currently making.

Depending on the way the interface works, most people don't go and query every page of the discover results. Most UI's might only show 10 items at a time, so you can only grab the first page and as the user scrolls be loading more pages behind the scene. This way you're only grabbing 20 items at a time. For examples of this depending what platform you're on, there's a number of apps you can see who have implemented something like that on our apps page.

We let you do approximately 3 requests per second so you can do multiple requests at a time if you spun up concurrent requests.

Depends what you're trying to build. Lots of apps just query our DB directly while others are doing a lot more custom things that require their own DB.

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