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 a total_pages parameter you can use to find the total number of pages.
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 the with_genres parameter. For instance, I believe that the Action genre's id is 28, so for action movies, you would pass with_genres=28as 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 genres
Reply by bobbyjoe
on May 13, 2020 at 3:55 PM
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.
Reply by morono
on May 13, 2020 at 4:19 PM
It works perfectly, Thanks so much!!!!!!
Reply by bobbyjoe
on May 13, 2020 at 4:24 PM
Sure thing. Glad to help
Reply by morono
on May 14, 2020 at 11:55 AM
Sorry, one question more How can I guess how many pages are there for horror movies?
Reply by bobbyjoe
on May 14, 2020 at 12:11 PM
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.Reply by morono
on May 14, 2020 at 10:16 PM
Thanks so much.
Reply by bobbyjoe
on May 14, 2020 at 10:22 PM
Sure