Last active
June 14, 2020 18:46
-
-
Save orjanv/8d020c2dcaf75f12f35d88e266e500d1 to your computer and use it in GitHub Desktop.
Find taglines for any film at IMDb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# | |
from imdb import IMDb # https://imdbpy.readthedocs.io | |
import sys | |
ia = IMDb() | |
if len(sys.argv) > 1: | |
movies = ia.search_movie(sys.argv[1]) | |
else: | |
movies = ia.search_movie(input("Search for a movie: ")) | |
movie = ia.get_movie(movies[0].movieID, info=['main', 'taglines', 'plot']) | |
try: | |
print('\nTop match found:', movie.get('title')) | |
print('Full title:', movie.get('long imdb title')) | |
print('TV Series or movie:', movie.get('kind').upper()) | |
movie_taglines = movie.get('taglines') | |
print('The top tagline:', movie_taglines[0]) | |
print('\nOther taglines:\n') | |
for i in movie_taglines[1:]: | |
print(' *', i) | |
print('\nThe movie plot:', movie.get('plot')[0]) | |
except: | |
print('\nNo taglines found, here is the top plot instead:\n') | |
print(movie.get('plot')[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment