From 6e928300bce4fae09b87a3d61406ffd49e4c960a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 6 Feb 2024 21:22:10 +0100 Subject: [PATCH] [flickr] handle non-JSON errors (#5131) --- gallery_dl/extractor/flickr.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index ea327654..f7dc3cc2 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -386,7 +386,11 @@ class FlickrAPI(oauth.OAuth1API): 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)