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®ion=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!
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de Travis Bell
le 28 septembre 2024 Ă 13h43
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.Réponse de ticao2 🇧🇷 pt-BR
le 28 septembre 2024 Ă 14h02
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
A possible solution to your question.
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".
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.
Repeat until you get all the movies.