Assistance de TMDB

How do i get composer of the movie?

9 réponses (sur la page 1 sur 1)

Jump to last post

Hi baskar,

You'll be able to find the "Original Music Composer" under the crew section found in the credits method.

Hi Travis,

This subject interests me, but your 11 years ago answer is left (page has been deprecated). Please, could you give me another on the new documentation location? Thank you in advance.

You can find movie credits method here. Or you can just query movie details with append_to_response=credits parameter (see here).

Thanks alot, talestalker.

Hi.

Sorry, but I still don't find how to get details of a movie... Is it possible to give me the complete URL for having the director o f the movie, the Original Music Composer, please? What do I have to add in the URL to have what I would like, please, like in the exemple "videos"? https://api.themoviedb.org/3/movie/27205?append_to_response=videos&language=en-US

Thanks, talestalker, but it's not all I need for what I would like to have... What do I have to put in the URL to have in a shield with ID "Composer" for exemple the Original Music Composer of the movie, please?

I have found we can make a request in credits, crew, job and then director, Original Music Composer... But I don't know how to use it...

Until now, I have a HTML page wich aloud me to have few details of a movie, but not all I would like... Here is it:

<html>
<head lang="fr">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Test moteur de recherche TMDB</title>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
</head>
 <body>

    <div class="box">
        <input type="text" id="query" /><button id="searchBtn1">Recherche</button><br/><br/>
        <img src="" class="poster" id="poster"/>
        <hr>
        Titre : <p id="movie_name"></p>
        <br/>
        Titre original : <p id="original_title"></p>
        <br/>
        Date de sortie : <p id="release_date"></p>
        <br/>
        Synopsis : <p id="movie_desc"></p>
        <br/>
        ID :<br/>
        <p id="id_film"></p>
        <br/>
    </div>

    <script type="text/javascript" charset="utf-8">
        $('#searchBtn1').click(function(){
            var api_key = 'MYAPIKEY';
            let query=$('#query').val();
        $.getJSON("https://api.themoviedb.org/3/search/movie?api_key="+api_key+"&language=fr-FR&query="+query+"&page=1&include_adult=false",function(data){
        console.log(data.results[0])
        $('#poster').attr("src","https://media.themoviedb.org/t/p/w600_and_h900_bestv2/"+data.results[0].poster_path)
        $('#movie_name').html(data.results[0].title)
        $('#original_title').html(data.results[0].original_title)
        $('#release_date').html(data.results[0].release_date)
        $('#movie_desc').html(data.results[0].overview)
        $('#id_film').html(data.results[0].id)
        })
        })
    </script>

    <style>
        .poster{width: 188px;}
    </style>
 </body>
</html>

I have found this other code, but I don't know what to change in it to have the Director and the Original Music Composer:

// Function to get movie detail object taking movie id as a parameter
function getMovieDetail(id) {
  return fetch('https://api.themoviedb.org/3/movie/' + id + '?language=fr-FR', options)
    .then((response) => response.json())
    .then((data) => {
      return data;
    })
    .catch(err => console.error(err));
}

// Function to open the modal and populate it with movie details
function openMovieModal(movie) {
  const modalTitle = document.getElementById("movieModalLabel");
  const modalPoster = document.getElementById("modalPoster");
  const modalReleaseDate = document.getElementById("modalReleaseDate");
  const modalRuntime = document.getElementById("modalRuntime");
  const modalOverview = document.getElementById("modalOverview");
  const modalVoteAverage = document.getElementById("modalVoteAverage");

  // Populate modal
  modalTitle.textContent = `${movie.title} (${new Date(movie.release_date).getFullYear()})`;
  modalPoster.src = `${baseImageUrl}${movie.poster_path}`;
  modalReleaseDate.textContent = movie.release_date;
  modalRuntime.textContent = `${Math.floor(movie.runtime / 60)}h ${movie.runtime % 60}min`;
  modalOverview.textContent = movie.overview;
  modalVoteAverage.textContent = movie.vote_average;

  // Open the modal
  const movieModal = new bootstrap.Modal(document.getElementById("movieModal"));
  movieModal.show();
}

Thanks, talestalker, but it's not all I need for what I would like to have... What do I have to put in the URL to have in a shield with ID "Composer" for exemple the Original Music Composer of the movie, please?

All TMDB API can do for you is provide a JSON that contains the data you want. In your case, this request (assuming you change the ### to your API key):

https://api.themoviedb.org/3/movie/27205?append_to_response=videos,credits&language=en-US&api_key=###

returns a 217 kB JSON that contains, among other things, the following (shortened and formatted for clarity):

{
  "adult": false,
  "backdrop_path": "/8ZTVqvKDQ8emSGUEMjsS4yHAwrp.jpg",
  "belongs_to_collection": null,
...
  "id": 27205,  
...
  "original_language": "en",
  "original_title": "Inception",
  "overview": "Cobb, a skilled thief who commits corporate espionage by infiltrating the subconscious of his targets is offered a chance to regain his old life as payment for a task considered to be impossible: \"inception\", the implantation of another person's idea into a target's subconscious.",
...
  "credits": {
    "cast": [
...
    ],
    "crew": [
...
      {
        "adult": false,
        "gender": 2,
        "id": 947,
        "known_for_department": "Sound",
        "name": "Hans Zimmer",
        "original_name": "Hans Zimmer",
        "popularity": 1.5703,
        "profile_path": "/tpQnDeHY15szIXvpnhlprufz4d.jpg",
        "credit_id": "56e8462cc3a368408400354c",
        "department": "Sound",
        "job": "Original Music Composer"
      },
...
      {
        "adult": false,
        "gender": 2,
        "id": 525,
        "known_for_department": "Directing",
        "name": "Christopher Nolan",
        "original_name": "Christopher Nolan",
        "popularity": 2.5244,
        "profile_path": "/xuAIuYSmsUzKlUMBFGVZaWsY3DZ.jpg",
        "credit_id": "5e83ac2ee33f830018359a00",
        "department": "Directing",
        "job": "Director"
      },
...
    ]
  }
}

TMDB support ends with the delivery of the above JSON and how you handle it is entirely up to your code. For example, if you are writing a javascript code, you will need to make a URL request and import the JSON into a javascript object (that's what the getMovieDetail(id) function does in your second example) and then find all the necessary information like director and original movie composer yourself. But for help with javascript please look somewhere else, such as Stack Overflow.

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