imdbpy rating data missing

1.7k Views Asked by At


i have a question about the imdbpy module for python, for some reason i can't retrieve some data about tv shows even though they exist on the imdb.com website.
for example if i use this code:

from imdb import IMDb
i = IMDb()
s = i.search_movie('killjoys')
m = i.get_movie(s[0].movieID)
print m.get('rating') 

the result is None even though on the imdb.com it's available so what should i so here? and thanks for the help :)

2

There are 2 best solutions below

1
On BEST ANSWER

the solution i found is to use a different library called omdb

import omdb
tv_show_name = "hannibal"
movie = omdb.get(title=tv_show_name, fullplot=True, media_type="series")
rating = movie.imdb_rating

there you go this might help someone someday ;)

1
On

Consider two things:

  1. the Movie objects in the result list from a query contains only limited data (the ones you can see from a search on the web).
  2. for a series, the "combined" page doesn't show the rating.

So, in your example, the first result would refer to imdbID 3952222. You can update the (main) information using:

i.update(m)

but again this would only add main information, by default (the ones from the http://www.imdb.com/title/tt3952222/combined page)

So, you need to also parse the "vote details" page with:

i.update(m, ['main', 'vote details'])

(or just 'vote details' if you don't need to fetch and parse the main details).