Python IMDbPY – Searching a movie
IMDbPY is a Python package which is used to retrieve and manage the data of the IMDb.
IMDb is an online database of information related to films, television programs, home videos, video games, and streaming content online – including cast, production crew and personal biographies, plot summaries, trivia, fan and critical reviews, and ratings.
In this article we will see how we can install this module and use this module to fetch variety of information.
Installation
In order to extract data from IMDb, we must first install the Python IMDbP library. This can be done by entering the command below in your command prompt or terminal:
pip install IMDbPY
Searching a movie
We can search a movie with the help of search_movie
Syntax : imdb_object.search_movie(name)
Argument : It takes string as argument, which is the movie name.
Return : It return list, items in list have same or similar title to the searched movie.
Below is the implementation
Python3
# importing the module import imdb # creating instance of IMDb ia = imdb.IMDb() # movie name name = " 3 idiots" # searching the movie search = ia.search_movie(name) # printing the result for i in search: print (i) |
Output :
3 Idiots 3 idiotas 3 Idiots 3 Idiots w/ GUNS 3 Idiots on Wheels 3 Idiots Try Candy! 3 Idiots; How Cho Copes with Slump The Idiots Idiots Vidiots Idiotest The Idiot Idiotsitter Idiots Idioten 4 Idiots Idiots Idiots Los 3 Idiotas iDiots
Another example:
Python3
# importing the module import imdb # creating instance of IMDb ia = imdb.IMDb() # movie name name = "Tarzan the wonder car" # searching the movie search = ia.search_movie(name) # printing the result print (search) |
Output :
[Movie id:0435437[http] title:_Taarzan: The Wonder Car (2004)_>]