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!
Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.
Doriți să evaluați sau să adăugați acest articol într-o listă?
Nu sunteți membru?
Răspuns de Travis Bell
pe data de 28 septembrie 2024 la ora 1:43 PM
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ăspuns de ticao2 🇧🇷 pt-BR
pe data de 28 septembrie 2024 la ora 2:02 PM
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.