Skip to content

Commit 255363c

Browse files
plotskimueslo
authored andcommitted
Catch LookError from imdbpie.get_title_ratings()
This should fix crashes with the following error: LookupError: Title not found. ttxxxxxxx is a redirection imdb id
1 parent 4a6f7ac commit 255363c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pythonbits/imdb.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ def __init__(self):
7272
self.movie = None
7373

7474
def get_rating(self, imdb_id):
75-
res = self.imdb.get_title_ratings(imdb_id)
75+
try:
76+
res = self.imdb.get_title_ratings(imdb_id)
77+
except LookupError:
78+
res = {}
7679
return (res.get('rating'), 10), res.get('ratingCount', 0)
7780

7881
def search(self, title):

0 commit comments

Comments
 (0)