Skip to content

Commit

Permalink
[redgifs] make 'date' available for directories (#5262)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Mar 1, 2024
1 parent cf9e99c commit 82c73c7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions gallery_dl/extractor/redgifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,22 @@ def items(self):

gif.update(metadata)
gif["count"] = cnt
gif["date"] = text.parse_timestamp(gif.get("createDate"))
yield Message.Directory, gif

for num, gif in enumerate(gifs, enum):
url = self._process(gif)
gif["_fallback"] = formats = self._formats(gif)
url = next(formats, None)

if not url:
self.log.warning(
"Skipping '%s' (format not available)", gif["id"])
continue

gif["num"] = num
gif["count"] = cnt
yield Message.Url, url, gif

def _process(self, gif):
gif["_fallback"] = formats = self._formats(gif)
gif["date"] = text.parse_timestamp(gif.get("createDate"))
return next(formats, None)

def _formats(self, gif):
urls = gif["urls"]
for fmt in self.formats:
Expand Down

0 comments on commit 82c73c7

Please sign in to comment.