How to get horror movies from TMDB?

Viewed 5229

I could get popular, now playing movies from TMDB. I wanna get the Horror movies. If there are any API URL and solution, let me know, please

https://api.themoviedb.org/3/movie/popular
https://api.themoviedb.org/3/movie/now_playing
https://api.themoviedb.org/3/genre/movie/list

I got popular movies like this

$popularMovies = Http::withToken(config('services.tmdb.token'))
->get('https://api.themoviedb.org/3/movie/popular')
->json()['results'];
2 Answers

Try using the API to search by genre (ID number).
As you can see from the link below, Horror films are classed under genre 27:

https://www.themoviedb.org/genre/27-horror/movie

So maybe you can try:

https://api.themoviedb.org/27/movie/horror

Or else:

https://api.themoviedb.org/3/discover/movie?api_key=XXXXX&with_genres=27

One can also try these steps

To get list of genres-

https://api.themoviedb.org/3/genre/movie/list

To get movies for a particular genre

https://api.themoviedb.org/3/list/{GENRE_ID}

Ex - https://api.themoviedb.org/3/list/27

since, 27 is the genre id for Horror

Related