Open In App

Python IMDbPY – Adding info set to the searched persons

Last Updated : 22 Apr, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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

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

Syntax : imdb_object.update(person_object, info = [‘biography’])

Argument : It take two argument one is the person 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 = "Amir khan"
    
# searching the name
persons = ia.search_person(name)
  
person = persons[0]
  
# getting more information
ia.update(person, info = ['biography'])
  
  
# printing biography
print(person['biography'])


Output :

[‘Amir Khan was born on December 8, 1986 in Bolton, Lancashire, England. He has been married to Faryal Makhdoom since May 31, 2013.::Anonymous’]

Another example




# importing the module
import imdb
   
# creating instance of IMDb
ia = imdb.IMDb()
   
# name
name = "Robert Downey"
    
# searching the name
persons = ia.search_person(name)
  
person = persons[0]
  
# getting more information
ia.update(person, info = ['other works'])
  
  
# printing other works
print(person['other works'])


Output :

[‘Recorded “Every Breath You Take” with Sting, and “Chances Are” with Vonda Shepard, both for the “Ally McBeal – Songs of the Heart” soundtrack.’, ‘(October 2001) Release of the music video for the single, “I Want Love, ” by Elton John, from John\’s album, “Songs From the West Coast, ” released October 1, 2001. The video was directed by Matthew Bice, and featured Robert Downey Jr., the only person to physically appear in the video, lip-syncing the entire song, in what appears to be a continuous take of one long shot where the camera follows Downey from room to room of a large empty mansion (actually the Greystone, or Doheny, Mansion in Beverly Hills, California).’, ‘(2002) Magazine advertisement for Skechers Collection footwear.’, “(2004) Promotion and limited personal appearance tour for The Route V50 (2004) film online, a twelve minute featurette he made, in 2003, for Volvo, then a division of Ford Motor Company’s Premier Automotive Group.”, “(Autumn-Winter 2004) Played the part of the basketball in a Fox Sports TV campaign. Fox recorded Downey’s voice and actually filmed his mouth, using computer graphics to superimpose it on the ball itself.”, ‘(November 23, 2004) Release of his first album, “The Futurist, ” by Sony Classical/SBMG Records (SK 92654), and consisting of eight pop ballads written and performed by Downey, and two cover songs, “Smile, ” written by Charles Chaplin, who was portrayed by Downey in the 1992 biographical film, Chaplin (1992), and “Your Move / Give Peace A Chance” medley, in part derived from the first half of the Yes song “I\’ve Seen All Good People”.’, ‘(1992) TV commercial, “Your Vote is Your Voice, ” with Robert Downey Jr. and Sarah Jessica Parker, and directed by Lawrence Bridges, for Rock The Vote.’, ‘(November 2012) TV commercial for Call of Duty: Black Ops II (2012) video game.’, ‘(March 17, 1989) Guest on “Live on Five”.’]



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads