1
0
Fork 0

imdb: fix exception when no movie found

This commit is contained in:
nemunaire 2018-06-20 07:46:46 +02:00
parent 125ae6ad0b
commit b8741bb1f7
1 changed files with 3 additions and 1 deletions

View File

@ -52,7 +52,9 @@ def find_movies(title, year=None):
# Make the request
data = web.getJSON(url, remove_callback=True)
if year is None:
if "d" not in data:
return None
elif year is None:
return data["d"]
else:
return [d for d in data["d"] if "y" in d and str(d["y"]) == year]