Assistance de TMDB

Hi, When trying to use the Discover API to discover movies for a watch_region = 'US' and watch_provider = '9' which is Amazon Prime Video, I know that there are a total of 965 pages and 19,296 results.

I use the tmdbv3api Python wrapper to find this out:

provider_movies_in_country = discover.discover_movies({'with_watch_providers':'9', 'watch_region':'US'})
provider_movies_in_country['total_pages'], provider_movies_in_country['total_results']

However, when I try to go past the 500th page by doing:

discover.discover_movies({'with_watch_providers':'9' 'watch_region':'US','page':501})

or this:

url = "https://api.themoviedb.org/3/discover/movie?include_adult=false&include_video=false&language=en-US&page=501&region=US&sort_by=popularity.desc&with_watch_providers=9"

headers = {
    "accept": "application/json",
    "Authorization": "Bearer XXXX"
}

response = requests.get(url, headers=headers)

I get this error:

TMDbException: Invalid page: Pages start at 1 and max at 500. They are expected to be an integer.

How to get the remaining 465 pages of results? Thank you!

2 réponses (sur la page 1 sur 1)

Jump to last post

Hi @charlie.tran,

There is no way to go beyond page 500. Your best bet is to split up your query with another filter or two. My usual suggestion is to use primary_release_date.gte/primary_release_date.lte. You could split it up into years, or perhaps decades to keep the total within the valid 10,000 result window.

The number/quantity of Items per Page and the number/quantity of Pages
cannot be changed, configured, specified, restricted, or anything like that.
There will always be up to 20 items per page.
And a maximum of 500 pages.
Therefore, at most 10,000 items.

Of course, depending on the parameters used in your API Request
this number/quantity can be much smaller.
Eventually zero.

In a Trending API Request, the quantities are greater.
A maximum of 1,000 pages
Therefore a maximum of 20,000 items

Here's what Travis Bell, the Administrator, said on 2022-06-28:
https://www.themoviedb.org/talk/62bb2ea18b959e00526428c9#62bb37d2c613ce0094222e71

Unfortunately, there is no planned change on the page limit.
We still show the total results so one can get an accurate count but that is all.

A possible solution to your question.

How to get the remaining 465 pages of results?

If you filter by date or by votes then you can define ranges.
For example. Make a first Request using "&sort_by=primary_release_date.desc".

https://api.themoviedb.org/3/discover/movie?api_key=THE_KEY&language=en-US&sort_by=release_date.desc&page=1&with_watch_providers=9  

Check the date of the last item on page 500.
Assume it is 2003-10-25
Make a new Request using "&primary_release_date.lte=YYY-MM-DD" using a day before the last item.

https://api.themoviedb.org/3/discover/movie?api_key=THE_KEY&language=en-US&sort_by=release_date.desc&page=1&with_watch_providers=9&primary_release_date.lte=2003-10-26  

Repeat until you get all the movies.

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenĂŞtre ouverte
? Ouvrir la fenĂŞtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenĂŞtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion