Sprijin Bază de date filme (The Movie Database)

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ăspunsuri (pe pagina 1 din 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.

Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.

Globale

s focalizează bara de căutare
p deschide meniul profilului
esc închide o fereastră deschisă
? deschide fereastra cu scurtături de la tastatură

Pe paginile media

b mergi înapoi (sau la părinte atunci când este cazul)
e mergi la pagina de editare

Pe paginile sezoanelor filmelor seriale

(săgeată dreapta) mergi la sezonul următor
(săgeată stânga) mergi la sezonul precedent

Pe paginile episoadelor filmelor seriale

(săgeată dreapta) mergi la episodul următor
(săgeată stânga) mergi la episodul precedent

Pe toate paginile de imagini

a deschide fereastra pentru adăugarea de imagini

Pe toate paginile de editare

t deschide selectorul de traduceri
ctrl+ s trimite formularul

Pe paginile de discuții

n crează o discuție nouă
w comută starea de vizionare
p comută publică/privată
c comută închisă/deschisă
a deschide activitatea
r răspunde la discuție
l mergi la ultimul răspuns
ctrl+ enter trimite mesajul
(săgeată dreapta) pagina următoare
(săgeată stânga) pagina precedentă

Setări

Doriți să evaluați sau să adăugați acest articol într-o listă?

Autentificare