celiao / tmdbsimple

A wrapper for The Movie Database API v3.
GNU General Public License v3.0
582 stars 121 forks source link

Search/Query movie by imdb id #60

Closed GhalebKhaled closed 4 years ago

GhalebKhaled commented 5 years ago

Hey I'm wondering if there is a way using tmdbsimple to support this, I'm trying to lookup movie by it's imdb id but so far I didn't find how to do this using this library, any help? https://www.themoviedb.org/talk/52a05011760ee3276f08138f

slef commented 4 years ago

Look at https://github.com/celiao/tmdbsimple/blob/master/tests/test_find.py

e.g. tmdb.Find('tt7869070').info(external_source='imdb_id')

celiao commented 4 years ago

Sure! Here's an example of how you can use tmdbsimple to look up information about a movie by it's imdb id.

import tmdbsimple as tmdb
tmdb.API_KEY = '<your api key>'
# If you want to execute multiple calls on find
find = tmdb.Find('tt0266543')
response = find.info(external_source='imdb_id')
response
{'movie_results': [{'id': 12,
   'video': False,
   'vote_count': 13478,
   'vote_average': 7.8,
   'title': 'Finding Nemo',
   'release_date': '2003-05-30',
   'original_language': 'en',
   'original_title': 'Finding Nemo',
   'genre_ids': [16, 10751],
   'backdrop_path': '/dFYguAfeVt19qAbzJ5mArn7DEJw.jpg',
   'adult': False,
   'overview': "Nemo, an adventurous young clownfish, is unexpectedly taken from his Great Barrier Reef home to a dentist's office aquarium. It's up to his worrisome father Marlin and a friendly but forgetful fish Dory to bring Nemo home -- meeting vegetarian sharks, surfer dude turtles, hypnotic jellyfish, hungry seagulls, and more along the way.",
   'poster_path': '/xVNSgrsvpcAHPnyKf2phYxyppNZ.jpg',
   'popularity': 31.27}],
 'person_results': [],
 'tv_results': [],
 'tv_episode_results': [],
 'tv_season_results': []}
# If you want to use a compact form
response = tmdb.Find('tt0266543').info(external_source='imdb_id')
response
{'movie_results': [{'id': 12,
   'video': False,
   'vote_count': 13478,
   'vote_average': 7.8,
   'title': 'Finding Nemo',
   'release_date': '2003-05-30',
   'original_language': 'en',
   'original_title': 'Finding Nemo',
   'genre_ids': [16, 10751],
   'backdrop_path': '/dFYguAfeVt19qAbzJ5mArn7DEJw.jpg',
   'adult': False,
   'overview': "Nemo, an adventurous young clownfish, is unexpectedly taken from his Great Barrier Reef home to a dentist's office aquarium. It's up to his worrisome father Marlin and a friendly but forgetful fish Dory to bring Nemo home -- meeting vegetarian sharks, surfer dude turtles, hypnotic jellyfish, hungry seagulls, and more along the way.",
   'poster_path': '/xVNSgrsvpcAHPnyKf2phYxyppNZ.jpg',
   'popularity': 31.27}],
 'person_results': [],
 'tv_results': [],
 'tv_episode_results': [],
 'tv_season_results': []}