Wednesday, July 3, 2024
HomeLanguagesPythonPython IMDbPY – Getting rating of the series

Python IMDbPY – Getting rating of the series

In this article we will see how we can get the rating of the series, rating in IMDb is given from 10 points the rating is based on the viewer experience, the higher the rating means views are highly satisfied or in other words they like the movie.

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 rating details from the dictionary

Below is the implementation




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


Output :

Money Heist
8.5

Another example




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


Output :

Sacred Games
8.7

Calisto Chipfumbu
Calisto Chipfumbuhttp://cchipfumbu@gmail.com
I have 5 years' worth of experience in the IT industry, primarily focused on Linux and Database administration. In those years, apart from learning significant technical knowledge, I also became comfortable working in a professional team and adapting to my environment, as I switched through 3 roles in that time.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments