Python IMDbPY – Adding info set to the searched movies

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 –

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

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

Another example

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


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.”]

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 :

Be the First to upvote.


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