Skip to content
Related Articles

Related Articles

Improve Article

Python IMDbPY – Getting plot of the series

  • Last Updated : 10 May, 2020

In this article we will see how we can get the plot of the series. Plot is the sequence of events where each affects the next one through the principle of cause-and-effect. The causal events of a plot can be thought of as a series of events linked by the connector “and so”.

In order to get this we have to do the following –

1. Get the series details with the help of get_movie method
2. As this object will act as dictionary therefore we have to filter the object
3. Get the main data of object with the help of data method which will return dictionary
4. Get the plot from the dictionary

Below is the implementation




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# id
code = "6077448"
  
# getting information
series = ia.get_movie(code)
  
# getting plot of the series
plot = series.data['plot']
  
# printing the object i.e name
print(series)
  
# print the plot
print(plot)

Output :



Sacred Games
['A link in their pasts leads an honest cop to a fugitive gang boss, whose cryptic warning spurs the officer on a quest to save Mumbai from cataclysm.', "Sartaj Singh, a Mumbai police officer, receives an anonymous phone call from a gangster who threatens to blow up the entire city. Amid the corrupt standards of Indian law enforcement begins a battle between a 'nobody' cop and ruthless gangster who perceives (sometimes) himself to be a God.::Cinema Theories", "Set in Mumbai, _Sacred Games_ (qv) delves into the city's intricate web of organized crime, corruption, politics and espionage that lie beneath India's economic renaissance. It is an epic masterwork of exceptional richness and power that interweaves the lives of the privileged, the famous, the wretched and the bloodthirsty.::ahmetkozan", 'Sartaj Singh a troubled police officer in Mumbai gets a call from gangster Ganesh Gaitonde who was missing for the last 16 years.He tells Sartaj that he has only 25 days to save Mumbai. Sartaj digs his past as to what made him a powerful gangster where he is helped by RNA officer Anjali Mathur.::alex.mjacko@gmail.com']

Another example




# importing the module
import imdb
  
# creating instance of IMDb
ia = imdb.IMDb()
  
# id
code = "6468322"
  
# getting information
series = ia.get_movie(code)
  
# getting plot of the series
plot = series.data['plot']
  
# printing the object i.e name
print(series)
  
# print the plot
print(plot)

Output :

Money Heist
['An unusual group of robbers attempt to carry out the most perfect robbery in Spanish history - stealing 2.4 billion euros from the Royal Mint of Spain.']

 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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :