For now, I can get only 20 movies. How can I get more movies?
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 bobbyjoe
le 13 mai 2020 à 15h55
Use the
page
parameter. Each page has 20 movies (besides the last, usually) and by appending&page=2
(or whatever page number) to your api call, you can get the second page. There is also atotal_pages
parameter you can use to find the total number of pages.Examples:
https://api.themoviedb.org/3/trending/movie/day?api_key=YOUR_API_KEY&page=1
https://api.themoviedb.org/3/trending/movie/day?api_key=YOUR_API_KEY&page=2
https://api.themoviedb.org/3/trending/movie/day?api_key=YOUR_API_KEY&page=3
https://api.themoviedb.org/3/trending/movie/day?api_key=YOUR_API_KEY&page=4
You should get a response like this:
Hope this helps.
Réponse de morono
le 13 mai 2020 à 16h19
It works perfectly, Thanks so much!!!!!!
Réponse de bobbyjoe
le 13 mai 2020 à 16h24
Sure thing. Glad to help
Réponse de morono
le 14 mai 2020 à 11h55
Sorry, one question more How can I guess how many pages are there for horror movies?
Réponse de bobbyjoe
le 14 mai 2020 à 12h11
If you are searching for a specific genre, then you can use the discover feature, and add the
with_genres
parameter. You would need to make a call to the/genres/movies/list
endpoint to get a list of genres, and their respective IDs. Once you find the ids of the genre you are looking for, then you can add them to thewith_genres
parameter. For instance, I believe that the Action genre's id is 28, so for action movies, you would passwith_genres=28
as parameter to the discover endpoint. If you want to add more genres to search, then you can, just seperate each with a comma like so:with_genres=28, 56, 345
(these aren't real genre IDs - you will have to find them from the genre list. To get the list of genreshttps://api.themoviedb.org/3/genre/movie/list?api_key=YOUR_API_KEY&language=en-US
To use the discover endpoint, see the docs:
https://developers.themoviedb.org/3/discover/movie-discover
Once you make that request, you can view the
total_pages
parameter in the response to find the total number of pages with your specific filters.Réponse de morono
le 14 mai 2020 à 22h16
Thanks so much.
Réponse de bobbyjoe
le 14 mai 2020 à 22h22
Sure