Skip to content

Instantly share code, notes, and snippets.

@orjanv
Last active June 14, 2020 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orjanv/8d020c2dcaf75f12f35d88e266e500d1 to your computer and use it in GitHub Desktop.
Save orjanv/8d020c2dcaf75f12f35d88e266e500d1 to your computer and use it in GitHub Desktop.
Find taglines for any film at IMDb
#!/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