Skip to content
Related Articles

Related Articles

Python IMDbPY – Adding info set to the searched movies

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 22 Apr, 2020

In this article we will see how we can add info set to the searched movies, search movies retrieve a fixed set of data and don’t have the concept of information sets. Therefore movie objects will have even less information than the defaults info set. For example, if you use a search method, the movie object in the result won’t have many of the keys that would be available on a movie get method.

In order to add info set to the searched movies we will use update method.

Syntax : imdb_object.update(movie_object, info = [‘plot’, ‘taglines’])

Argument : It take two argument one is the movie object for which we want more information and the other is the info set i.e list of keys

Action performed : It will retrieve the info set information

Below is the implementation –




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# name
name = "3 idiots"
    
# searching the name
movies = ia.search_movie(name)
  
movie = movies[0]
  
# getting more information
ia.update(movie, info = ['taglines'])
  
  
# printing tagline
print(movie['taglines'])

Output :

["Don't be Stupid. Be an I.D.I.O.T."]

Another example




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# name
name = "Success story"
    
# searching the name
movies = ia.search_movie(name)
  
movie = movies[0]
  
# getting more information
ia.update(movie, info = ['plot'])
  
  
# printing plot
print(movie['plot'])

Output :

[“Panagis Pandoras: a wealthy psychiatrist, from a publishing background, charming and unscrupulous. Tzortzina Tzelepi: an unemployed actress, daughter of a bourgeois couple, beautiful and determined to succeed. The two of them, despite being polar opposites, suddenly fall in love, recklessly and passionately, and get married. Tzortzina, in a desperate effort to fit in Panagis’s world, denies her true self. Her creative dead-end, combined with a difficult pregnancy, completely transform her as she is starting to realize that nothing in her married life is as she imagined. The radical change in financial terms, Panagis’s father suicide over debt, and Panagis’s upcoming involvement in politics, sharpen their differences. The admiration, passion and attraction, have now given their place to disappointment, isolation and antagonism. Then, the ruthlessness starts, and their love story ultimately becomes a tale of revenge and hate, as they both resort to extremes, in order to survive.”]


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!