Skip to content
Related Articles

Related Articles

Python IMDbPY – Searching a movie
  • Last Updated : 22 Apr, 2020

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




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# movie name
name = "3 idiots"
  
# searchning 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:




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# movie name
name = "Tarzan the wonder car"
  
# searchning the movie
search = ia.search_movie(name)
  
# printing the result
print(search)

Output :

[Movie id:0435437[http] title:_Taarzan: The Wonder Car (2004)_>]

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :