mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[redgifs] improve URL extraction
Fields inside 'urls' can be None, which would have caused an exception with the old method.
This commit is contained in:
parent
2befed1a96
commit
7cb303d745
@ -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"):
|
||||
|
Loading…
Reference in New Issue
Block a user