Skip to content
Related Articles

Related Articles

Python IMDbPY – Retrieving movie using movie ID
  • Last Updated : 22 Apr, 2020

In this article we will see how we can retrieve the data of movie using its movie ID, movie id is the unique id given to each movie by IMDb. We can use search_movie method to search the movies by their name but it gives many movies as they have same names therefore retrieving a movie by its id is a better option.

In order to search a movie by its id we use get_movie method.

Syntax : imdb_object.get_movie(id)

Argument : It takes string as argument which is movie id

Return : It returns imdb Movie object.



Below is the implementation.




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# ID
code = "1187043"
   
# searching the Id
search = ia.get_movie(code)
  
# printing the search
print(search)

Output :

3 Idiots

Another example




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# ID
code = "4434004"
   
# searching the Id
search = ia.get_movie(code)
  
# printing the search
print(search)

Output :

Udta Punjab

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
Recommended Articles
Page :