본문 바로가기

프로그래밍/영화 TMDB API

영화 정보 앱 만들기 - TMDB API 사용법, Keywords

TMDB API 활용 예제 앱입니다.

https://play.google.com/store/apps/details?id=com.enigmah2k.movieinfo

 

영화정보 - Google Play 앱

영화 또는 TV 시리즈 정보를 검색할 수 있습니다. TMDB API를 사용하여 만들었습니다. 한국에 소개되지 않은 컨텐츠를 찾을 수 있습니다.

play.google.com

TMDB API - Keywords

키워드 기준으로 정보를 가져옵니다.

 

값을 가져오기 위해서는 {keyword_id} 가 필요합니다.

{keyword_id}는 아래 API를 통해 가져올 수 있습니다.

 

Movies - Get Keywords

Search - Search Keywords

TV - Get Keywords

 

아래 링크가 Keywords 관련 API 상세입니다.

https://developers.themoviedb.org/3/keywords/get-keyword-details

 

각 API에 대해 알아보겠습니다.

 

=============================================

< API 설명 >

1. Get Details

키워드 ID 와 name 정보를 가져옵니다.

 

아래와 같이 호출하면 상세정보를 얻을 수 있습니다.

https://api.themoviedb.org/3/keyword/{keyword_id}?api_key=<<api_key>>

{"id":3417,"name":"wormhole"}

 

아래는 응답 결과 입니다.

{
  "id": 3417,
  "name": "wormhole"
}

 

2. Get Movies

키워드에 속하는 영화 정보를 가져옵니다.

 

아래와 같이 호출하면 상세정보를 얻을 수 있습니다.

https://api.themoviedb.org/3/keyword/{keyword_id}/movies?api_key=<<api_key>>

{"id":3417,"page":1,"results":[{"id":157336,"popularity":87.364,"vote_count":24314,"overview":"The adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage.","release_date":"2014-11-05","adult":false,"backdrop_path":"/xJHokMbljvjADYdit5fK5VQsXEG.jpg","genre_ids":[12,18,878],"title":"Interstellar","original_language":"en","original_title":"Interstellar","poster_path":"/gEU2QniE6E77NI6lCU6MxlNBvIx.jpg","vote_average":8.3,"video":false},{"id":10796,"popularity":18.374,"vote_count":1010,"overview":"A sheriff's deputy fights an alternate universe version of himself who grows stronger with each alternate self he kills.","release_date":"2001-11-02","adult":false,"backdrop_path":"/2JApfvtgf2snKUtOFn8d1wm5pDU.jpg","genre_ids":[28,878,53],"vote_average":6,"original_language":"en","original_title":"The One","poster_path":"/gcr3t71KmeXINemMrhaGBGVJPwW.jpg","title":"The One","video":false},{"id":686,"popularity":16.15,"vote_count":2913,"overview":"Contact is a science fiction film about an encounter with alien intelligence. Based on the novel by Carl Sagan the film starred Jodie Foster as the one chosen scientist who must make some difficult decisions between her beliefs, the truth, and reality.","release_date":"1997-07-11","adult":false,"backdrop_path":"/x5Z2BjuUfEEwYWZccDwbU9KSEqj.jpg","genre_ids":
...

 

아래는 응답 결과 입니다.

{
  "id": 3417,
  "page": 1,
  "results": [
    {
      "adult": false,
      "backdrop_path": null,
      "genre_ids": [
        18
      ],
      "id": 157336,
      "original_language": "en",
      "original_title": "Interstellar",
      "overview": "Interstellar chronicles the adventures of a group of explorers who make use of a newly discovered wormhole to surpass the limitations on human space travel and conquer the vast distances involved in an interstellar voyage. Or is it?",
      "release_date": "2014-11-05",
      "poster_path": "/qzjOE2ylfiHjbork6rupuDJg0YX.jpg",
      "popularity": 5.531964,
      "title": "Interstellar",
      "video": false,
      "vote_average": 8.4,
      "vote_count": 2085
    }
  ],
  "total_pages": 1,
  "total_results": 6
}

 

반응형