Python IMDbPY – Retrieving art department cast from the movie object
Last Updated :
08 May, 2020
In this article we will see how we can retrieve the art department cast that involved in the movie from the movie information, 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 to get art department cast list : cast = movie[‘art department’]
Here movie is the object returned by the get_movie method which act as the dictionary
Below is the implementation.
import imdb
ia = imdb.IMDb()
code = "1187043"
movie = ia.get_movie(code)
print (movie)
print ( "===============" )
cast = movie[ 'art department' ]
actor = cast[ 1 ]
print (actor)
|
Output :
3 Idiots
===============
Ajay Chodanker
Another example :
import imdb
ia = imdb.IMDb()
code = "4434004"
movie = ia.get_movie(code)
print (movie)
print ( "===============" )
cast = movie[ 'art department' ]
print (cast[ 0 ])
|
Output :
Udta Punjab
===============
Pallavi Pethkar
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...