Fork me on GitHub
IMDbPY website moved to https://imdbpy.github.io/

Documentation

Read the documentation online.

Examples

Here is a short example of how you can use it directly from the Python interpreter or in your own programs:

#!/usr/bin/env python3

# Import the imdb package.
import imdb

# Create the object that will be used to access the IMDb's database.
ia = imdb.IMDb() # by default access the web.

# Search for a movie (get a list of Movie objects).
s_result = ia.search_movie('The Untouchables')

# Print the long imdb canonical title and movieID of the results.
for item in s_result:
   print(item['long imdb canonical title'], item.movieID)

# Retrieves default information for the first result (a Movie object).
the_unt = s_result[0]
ia.update(the_unt)

# Print some information.
print(the_unt['runtime'])
print(the_unt['rating'])
director = the_unt['director'] # get a list of Person objects.

# Get the first item listed as a "goof".
ia.update(the_unt, 'goofs')
print(the_unt['goofs'][0])

# The first "trivia" for the first director.
b_depalma = director[0]
ia.update(b_depalma, 'trivia')
print(b_depalma['trivia'][0])

Another example, using a local SQL database, after you've populated it with the data from the plain text data files using the imdbpy2sql.py script like this (assuming you've already created an imdb empty database: see documentation for more information):

python3 imdbpy2sql.py -d /path/to/the/plain/text/data/files/ -u mysql://USER:PASSWD@localhost/imdb
#!/usr/bin/env python3

from imdb import IMDb

ia = IMDb('sql', uri='mysql://USER:PASSWORD@localhost/imdb')
search_sk = ia.search_person(u'Stanley Kubrick')
for person in search_sk:
   print(person['name'], person.personID)

sk = search_sk[0]
ia.update(sk)
print('Last directed movie:', sk['director'][0])

Get help

Mailing list

imdbpy-help@lists.sourceforge.net

The mailing list is open also to non-subscribers (anyone can send emails) but is moderated by default: your first message needs to be approved; if it's on-topic, the succeeding ones will be automatically accepted.

Subscribe to the list.

Archives:

Stackoverflow.com

You can search for the questions tagged "imdbpy" on Stackoverflow.com.