https://developer.themoviedb.org/docs/getting-started > API Reference > https://developer.themoviedb.org/reference/movie-details
https://velog.io/@ncookie/IMDB-TMDB-API-사용법-정리
import requests
movie detail
movie_id = 496243 # 기생충
url = f'<https://api.themoviedb.org/3/movie/{movie_id}?language=ko-KR>'
headers = {
'Authorization': f"Bearer {os.getenv('KC_TMDB_READ_ACCESS_TOKEN')}",
'accept': 'application/json'
}
response = requests.get(url, headers=headers)
movie_data = response.json()
https://image.tmdb.org/t/p/original/`poster_url`
credits
import requests
url = "<https://api.themoviedb.org/3/movie/496243/credits?language=en-US>"
headers = {
"accept": "application/json",
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhZDgyNDkxMTMzZDYwNGI2Y2E3ZDU3ODBiMjc1OGQxMiIsIm5iZiI6MTcxOTIzMjMyMy4wNjI5MSwic3ViIjoiNjY3OTY1MGE3ZTIxYjUwYzU4OWY0NjRlIiwic2NvcGVzIjpbImFwaV9yZWFkIl0sInZlcnNpb24iOjF9.AfJs-c4qiur7dLNhsFT6Em97We_ZiulhPFsI49WbJuo"
}
response = requests.get(url, headers=headers)
print(response.text)
이미지
import requests
url = f'<https://api.themoviedb.org/3/movie/{movie_id}/images>'
headers = {
'Authorization': f"Bearer {os.getenv('KC_TMDB_READ_ACCESS_TOKEN')}",
'accept': 'application/json'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
else:
print(f"Failed to retrieve data: {response.status_code}")
data