Υποστήριξη για το The Movie Database

I am working on a Ionic/Angular project where I was able to make a http request to retrieve all the popular movies. Now when a user click on a specific movie, for example The Martian. Then I want to read out some data like movie poster, title, actors, genres, etc. Now I noticed that the id numbers are shown for genre (which represents categories like scifi, action, etc). My question is how do I make a http request to retrieve the genres of a specific movie (for example the movie The Martian).

6 απαντήσεις(στη σελίδα 1 από 1)

Jump to last post

Hi GY22,

If you make a call to the primary movie method:

https://api.themoviedb.org/3/movie/286217?api_key=###

You'll see that it returns this field:

"genres":[{"id":18,"name":"Drama"}]

The ids are only listed on the list methods (popular, now playing, etc...).

If you wanted to store a reference in your app as to which id maps to what genre you can call the /genre/movie/list method and cache it locally.

Cheers.

Hi. :D

How can I use in my application the genres from a movie that have more than a genre? For example: "genres":[{"id":18,"name":"Drama"},{"id":10752,"name":"War"}]. I'm using Angular.

Thanks!

Hi julianopadilha,

While I've never used Angular, all the genres field is is an array. Just iterate through the array like you would any other object in JavaScript.

Thanks! Worked. :D

how to get a single genre like example Drama content

@marcgregory said:
how to get a single genre like example Drama content

I don't know if I understood your request correctly.
You want an API Request that in the response contains only movies that have the Drama genre in addition to the other genres.

Search Movies with a Specific Genre

First you need to know what Genre ID you want to search for.
The list of Genre IDs is here, for Movie and TV Show.
get/genre/movie/list - https://developers.themoviedb.org/3/genres/get-movie-list
get/genre/tv/list - https://developers.themoviedb.org/3/genres/get-tv-list

In this case, the Drama Genre ID for movies is 18.

Then you make a Discover API Request
get/discover/movie - https://developers.themoviedb.org/3/discover/movie-discover
And use the filter &with_genres=18
If you want you can filter by two Genres, for example also Thriller ID 53
AND (with comma) &with_genres=18.53
OR (with Pipe) &with_genres=18|53
You can use any other filter simultaneously. Year, date etc...

Δεν μπορείτε να βρείτε κάποια ταινία ή σειρά; Συνδεθείτε για να τη δημιουργήσετε.

Σε όλες τις σελίδες

s Εστίαση στη μπάρα αναζήτησης
p Άνοιγμα μενού προφίλ
esc Κλείσιμο ανοιχτού παραθύρου
? Άνοιγμα παραθύρου συντομεύσεων πληκτρολογίου

Στις σελίδες μέσων

b Επιστροφή στην προηγούμενη σελίδα(ή στην αρχική σελίδα όταν είναι εφικτό)
e Μετάβαση στη σελίδα επεξεργασίας

Στις σελίδες κύκλων σειρών

(Δεξιό βέλος) Μετάβαση στον επόμενο κύκλο
(Αριστερό βέλος) Μετάβαση στον προηγούμενο κύκλο

Στις σελίδες επεισοδίων σειρών

(Δεξιό βέλος) Μετάβαση στο επόμενο επεισόδιο
(Αριστερό βέλος) Μετάβαση στο προηγούμενο επεισόδιο

Σε όλες τις σελίδες εικόνων

a Άνοιγμα παραθύρου προσθήκης εικόνας

Σε όλες τις σελίδες επεξεργασίας

t Άνοιγμα επιλογέα μετάφρασης
ctrl+ s Υποβολή φόρμας

Στις σελίδες συζήτησης

n Δημιουργία νέας συζήτησης
w Ρύθμιση κατάστασης παρακολούθησης
p Ρύθμιση ως δημόσια/ιδιωτική
c Ρύθμιση ανοίγματος/κλεισίματος
a Άνοιγμα δραστηριότητας
r Απάντηση στη συζήτηση
l Μετάβαση στην τελευταία απάντηση
ctrl+ enter Υποβολή μηνύματος
(Δεξιό βέλος) Επόμενη σελίδα
(Αριστερό βέλος) Προηγούμενη σελίδα

Ρυθμίσεις

Θέλετε να αξιολογήσετε ή να προσθέσετε αυτό το στοιχείο σε μια λίστα;

Σύνδεση