I'm new to working with APIs.
I can get all the info I need about a movie
conn = http.client.HTTPSConnection("api.themoviedb.org")
payload = "{}"
conn.request("GET", "/3/movie/now_playing?page=1&language=en-US&api_key=MYKEY&append_to_response=videos", payload)
res = conn.getresponse()
data = res.read().decode('utf-8')
json_data = json.loads(data)
movie = []
for i in range(0,NUMBER_OF_MOVIES):
title = json_data["results"][i]["title"],
overview = json_data["results"][i]["overview"]
# ...
# ET CETERA
movie[title, overview]
But I also need to the the trailer.
How do I add the Youtube key in that same list?
I saw I need to make a request to
movie/{movie_id}/videos?api_key=<>&language=en-US
But I'm not sure how to implement it.
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on August 14, 2017 at 6:59 PM
Hi @3x3m3 There is no way to do this with the now playing method. You need to make an additional request to the /movie/{id}/videos method.
If you need to get more details than that, make sure to read about
append_to_response
.