Assistance de TMDB

When I download the API for the Movie API, there is a video object in the results, but it is set to false.

It looks like this:

"video":false,

I'm getting the API from this URL: http://api.themoviedb.org/3/movie/popular

Is it possible to download video trailers from this API? I ask because I notice that there are video trailers on www.themoviedb.org.

25 réponses (sur la page 1 sur 2)

Jump to last post

Page suivanteDernière page

Hi Codewarrior

yes you can obtain trailers for any movie were trailers are available. Please review the documentation using the link below, navigate to movies -> videos

http://docs.themoviedb.apiary.io/#reference/movies/movieidvideos

Click on the GET button to see a sample response and the get url required.

Trailers work alongside YouTube, the sample provided is for fight club (awful movie lol)

the Json response gives a Key with a value of SUXWAEX2jlg

Sample:

YouTube URL: https://www.youtube.com/watch?v=

Key: SUXWAEX2jlg

Full URL: https://www.youtube.com/watch?v=SUXWAEX2jlg

hope this helps

The problem is that most of the videos don't have a response for the video object. Most movies say:

"video":false,

I'm still not sure how to call a video when it is returning false.

Hi codewarrior_777,

The classification of being a "video" or not has nothing to do with whether there's any videos linked from YouTube. "video" is just our classification for items that aren't necessarily truly movies. You can read more about this here.

OK, maybe I'm not making myself clear.

So here is the API response:

"adult": false, "backdrop_path": "/6bbZ6XyvgfjhQwbplnUh1LSj1ky.jpg", "genre_ids": [ 18 ], "id": 244786, "original_language": "en", "original_title": "Whiplash", "overview": "Under the direction of a ruthless instructor, a talented young drummer begins to pursue perfection at any cost, even his humanity.", "release_date": "2014-10-10", "poster_path": "/lIv1QinFqz4dlp5U4lQ6HaiskOZ.jpg", "popularity": 8.441533, "title": "Whiplash", "video": false, "vote_average": 8.5, "vote_count": 856 },

So far, I'm able to pull "overview", "poster_path" and "title" objects from this API. I don't see any response for video though. I don't see it in any of the responses from the full array.

You have suggested using the Key like so "Key: SUXWAEX2jlg" and then just using the YouTube URL: https://www.youtube.com/watch?v=

The problem is that I don't see the "key" response in the API. Where do find this?

Currently, I'm using this link: http://api.themoviedb.org/3/movie/popular

Am I using the wrong link? Are the videos available in another link?

Thanks

You need to call the method that Kevin linked to above: http://docs.themoviedb.apiary.io/#reference/movies/movieidvideos

You cannot get the video responses in any of the list methods, only by calling the primary movie video method:

http://api.themoviedb.org/3/movie/131634/videos?api_key=###

Which you can do with append_to_response as well (to get everything in a single HTTP call):

http://api.themoviedb.org/3/movie/131634?api_key=###&append_to_response=videos

Hope that make more sense now.

The link you posted is saying "This page has been deprecated." Is there is a new method to get the trailer of a movie?

@deery5000 said:

Hi Codewarrior

yes you can obtain trailers for any movie were trailers are available. Please review the documentation using the link below, navigate to movies -> videos

http://docs.themoviedb.apiary.io/#reference/movies/movieidvideos

Click on the GET button to see a sample response and the get url required.

Trailers work alongside YouTube, the sample provided is for fight club (awful movie lol)

the Json response gives a Key with a value of SUXWAEX2jlg

Sample:

YouTube URL: https://www.youtube.com/watch?v=

Key: SUXWAEX2jlg

Full URL: https://www.youtube.com/watch?v=SUXWAEX2jlg

hope this helps

hi but how you do it with recyclerview eith couple of item its not the same things???

hi but how you do it with recyclerview eith couple of item its not the same things???

I'm not sure I understand the question, can you elaborate on this?

Edit I see you posted another question about this here. I've noticed you do this before, there's no need to post the same question across 2 or 3 threads. It just makes it harder to help. I'll close this one now since you have a dedicated thread for your question.

@travisbell said:

hi but how you do it with recyclerview eith couple of item its not the same things???

I'm not sure I understand the question, can you elaborate on this?

Hi travis whan i clicking won item of the recyclerview i want the video to show of the position of the item that i click so i dont now how to set the video api and also i need to set youtubeplayerView ????

Hi @aharon

I have never used RecyclerView (I had to Google what that was) so unfortunately, I can't be any help. You'll do best to follow @jeras' advice on the other thread and ask your question on something like StackOverflow.

@travisbell said:

Hi @aharon

I have never used RecyclerView (I had to Google what that was) so unfortunately, I can't be any help. You'll do best to follow @jeras' advice on the other thread and ask your question on something like StackOverflow.

Hi travis its not metter what list its can be listview i only dont now how to deal with the id of the video api to get the video acording where i click thank you

When you make a request to the videos method, you will get an array of results back. An example (I've truncated the response):

https://api.themoviedb.org/3/movie/263115?api_key=###&apprend_to_response=videos
{
  ...
  "videos": {
    "results": [
      {
        "id": "58ba59ba925141609b018ea9",
        "iso_639_1": "en",
        "iso_3166_1": "US",
        "key": "Div0iP65aZo",
        "name": "Official Trailer",
        "site": "YouTube",
        "size": 1080,
        "type": "Trailer"
      },
      {
        "id": "58ba59f0c3a36866300175d0",
        "iso_639_1": "en",
        "iso_3166_1": "US",
        "key": "RH3OxVFvTeg",
        "name": "Trailer 2",
        "site": "YouTube",
        "size": 1080,
        "type": "Trailer"
      }
    ]
  }
}

So by iterating over the videos results array you can get the key field. That is the YouTube id. In the example above, the first video has the key of Div0iP65aZo. You can build a YouTube URL like so:

http://youtube.com/watch?v=Div0iP65aZo

That's all there is to it. Hope that helps.

@travisbell said:

When you make a request to the videos method, you will get an array of results back. An example (I've truncated the response):

https://api.themoviedb.org/3/movie/263115?api_key=###&apprend_to_response=videos
{
  ...
  "videos": {
    "results": [
      {
        "id": "58ba59ba925141609b018ea9",
        "iso_639_1": "en",
        "iso_3166_1": "US",
        "key": "Div0iP65aZo",
        "name": "Official Trailer",
        "site": "YouTube",
        "size": 1080,
        "type": "Trailer"
      },
      {
        "id": "58ba59f0c3a36866300175d0",
        "iso_639_1": "en",
        "iso_3166_1": "US",
        "key": "RH3OxVFvTeg",
        "name": "Trailer 2",
        "site": "YouTube",
        "size": 1080,
        "type": "Trailer"
      }
    ]
  }
}

So by iterating over the videos results array you can get the key field. That is the YouTube id. In the example above, the first video has the key of Div0iP65aZo. You can build a YouTube URL like so:

http://youtube.com/watch?v=Div0iP65aZo

That's all there is to it. Hope that helps.

this is id (video) for a particular one item our also for all list of item??

thank you

this is id (video) for a particular one item our also for all list of item??

My example is one video (from the results array, which can contain many) for one specific movie, Logan, id: 263115).

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenĂŞtre ouverte
? Ouvrir la fenĂŞtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenĂŞtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion