From 7cb303d74557a609fcc054860852c93f1b418b58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 5 Nov 2021 20:02:43 +0100 Subject: [PATCH] [redgifs] improve URL extraction Fields inside 'urls' can be None, which would have caused an exception with the old method. --- gallery_dl/extractor/redgifs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gallery_dl/extractor/redgifs.py b/gallery_dl/extractor/redgifs.py index 7ecb92cd..df50f700 100644 --- a/gallery_dl/extractor/redgifs.py +++ b/gallery_dl/extractor/redgifs.py @@ -21,7 +21,7 @@ class RedgifsExtractor(Extractor): def __init__(self, match): Extractor.__init__(self, match) - self.key = match.group(1).lower() + self.key = match.group(1) formats = self.config("format") if formats is None: @@ -51,8 +51,8 @@ class RedgifsExtractor(Extractor): def _formats(self, gif): urls = gif["urls"] for fmt in self.formats: - if fmt in urls: - url = urls[fmt] + url = urls.get(fmt) + if url: text.nameext_from_url(url, gif) yield url @@ -129,7 +129,7 @@ class RedgifsAPI(): self.extractor = extractor def gif(self, gif_id): - endpoint = "/v2/gifs/" + gif_id + endpoint = "/v2/gifs/" + gif_id.lower() return self._call(endpoint)["gif"] def user(self, user, order="best"):