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

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


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.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.