mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[gelbooru] display error for invalid API responses (#4903)
This commit is contained in:
parent
c25bdbae91
commit
cbfb7bfdf1
@ -32,10 +32,13 @@ class GelbooruBase():
|
||||
url = self.root + "/index.php?page=dapi&q=index&json=1"
|
||||
data = self.request(url, params=params).json()
|
||||
|
||||
if key not in data:
|
||||
return ()
|
||||
try:
|
||||
posts = data[key]
|
||||
except KeyError:
|
||||
self.log.error("Incomplete API response (missing '%s')", key)
|
||||
self.log.debug("%s", data)
|
||||
return []
|
||||
|
||||
posts = data[key]
|
||||
if not isinstance(posts, list):
|
||||
return (posts,)
|
||||
return posts
|
||||
|
Loading…
Reference in New Issue
Block a user