Hi so i am working with angular (javascript) and i was able to retrieve the data of a specific movie and now i want to access the genre but i am not sure how to approach the data. so for example if i want to access the title of the movie i would do something like this: results.original_title but with genres its in an array [id, name] and i was not able to retrieve the name of a genre like so results.genre.name so how to i access this node?
Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.
Doriți să evaluați sau să adăugați acest articol într-o listă?
Nu sunteți membru?
Răspuns de Travis Bell
pe data de 20 octombrie 2015 la ora 11:09 AM
Hi GY22,
It sounds like these results are coming from either search/discover/a featured list. You'll want to pull down /genre/movie/list and then use it as a reference. You only need to call that once and you can cache it to always have the id/name map.
Cheers.
Răspuns de gekkejongen
pe data de 21 octombrie 2015 la ora 2:24 PM
Sorry for hijacking this topic but I have a little problem. I use /genre/movie/list to get the genres. I get a list with all the ID's, but every name = null. Anyone knows what the problem is?
Răspuns de Travis Bell
pe data de 21 octombrie 2015 la ora 3:40 PM
Hi gekkejongen,
I don't seem to be seeing this. What's the exact request you're making?
Răspuns de gekkejongen
pe data de 21 octombrie 2015 la ora 5:00 PM
hi, i request to genre/movie/list with parameters api_key & language.
This is what i get as response:
{"genres":[{"id":28,"name":null},{"id":12,"name":null},{"id":16,"name":null},{"id":35,"name":null},{"id":80,"name":null},{"id":99,"name":null},{"id":18,"name":null},{"id":10751,"name":null},{"id":14,"name":null},{"id":10769,"name":null},{"id":36,"name":null},{"id":27,"name":null},{"id":10402,"name":null},{"id":9648,"name":null},{"id":10749,"name":null},{"id":878,"name":null},{"id":10770,"name":null},{"id":53,"name":null},{"id":10752,"name":null},{"id":37,"name":null}]}
Răspuns de Travis Bell
pe data de 21 octombrie 2015 la ora 5:12 PM
What language are you requesting?
Răspuns de gekkejongen
pe data de 21 octombrie 2015 la ora 5:17 PM
en-US
Răspuns de Travis Bell
pe data de 21 octombrie 2015 la ora 5:40 PM
Hi gekkejongen,
That is not a valid language on TMDb. Try using just 'en'.
Cheers.
Răspuns de ebowe
pe data de 10 martie 2016 la ora 12:20 PM
Hi I have the following problem:
I need the genres in Spanish (es)!
Răspuns de Travis Bell
pe data de 10 martie 2016 la ora 12:32 PM
Yes, there was a bug that slipped through in yesterday's deploy. In about ~4 hours when the cached pages are purged from the cache, the names will display properly.