imdb: fix exception when no movie found
This commit is contained in:
parent
125ae6ad0b
commit
b8741bb1f7
|
@ -52,7 +52,9 @@ def find_movies(title, year=None):
|
||||||
# Make the request
|
# Make the request
|
||||||
data = web.getJSON(url, remove_callback=True)
|
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"]
|
return data["d"]
|
||||||
else:
|
else:
|
||||||
return [d for d in data["d"] if "y" in d and str(d["y"]) == year]
|
return [d for d in data["d"] if "y" in d and str(d["y"]) == year]
|
||||||
|
|
Loading…
Reference in New Issue