Skip to content

Commit

Permalink
[flickr] handle non-JSON errors (#5131)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Feb 6, 2024
1 parent 90ac6d7 commit 6e92830
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gallery_dl/extractor/flickr.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ def _call(self, method, params):
params["nojsoncallback"] = "1"
if self.api_key:
params["api_key"] = self.api_key
data = self.request(self.API_URL, params=params).json()
response = self.request(self.API_URL, params=params)
try:
data = response.json()
except ValueError:
data = {"code": -1, "message": response.content}
if "code" in data:
msg = data.get("message")
self.log.debug("Server response: %s", data)
Expand Down

0 comments on commit 6e92830

Please sign in to comment.