Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # Import the imdb package.
  4. import imdb
  5.  
  6. # Create the object that will be used to access the IMDb's database.
  7. ia = imdb.IMDb() # by default access the web.
  8.  
  9. # Search for a movie (get a list of Movie objects).
  10. s_result = ia.search_movie('The Untouchables')
  11.  
  12. # Print the long imdb canonical title and movieID of the results.
  13. for item in s_result:
  14. print item['long imdb canonical title'], item.movieID
  15.  
  16. # Retrieves default information for the first result (a Movie object).
  17. the_unt = s_result[0]
  18. ia.update(the_unt)
  19.  
  20. # Print some information.
  21. print the_unt['runtime']
  22. print the_unt['rating']
  23. director = the_unt['director'] # get a list of Person objects.
  24.  
  25. # Get the first item listed as a "goof".
  26. ia.update(the_unt, 'goofs')
  27. print the_unt['goofs'][0]
  28.  
  29. # The first "trivia" for the first director.
  30. b_depalma = director[0]
  31. ia.update(b_depalma)
  32. print b_depalma['trivia'][0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement