Getting movie ID from searched movies
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# name
name = "Udta punjab"
# searching the name
search = ia.search_movie(name)
# loop for printing the name and id
for i in range(len(search)):
# getting the id
id = search[i].movieID
# printing it
print(search[i]['title'] + " : " + id )
使用ID对电影进行搜索
from imdb import IMDb
ia = IMDb()
the_matrix = ia.get_movie('0133093')
print the_matrix['director']
for person in ia.search_person('Mel Gibson'):
print person.personID, person['name']