Skip to content

Commit

Permalink
[reddit] add 'previews' option (#4322)
Browse files Browse the repository at this point in the history
another way to disable this new behavior
  • Loading branch information
mikf committed Sep 22, 2023
1 parent 918ba4f commit 82296b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2716,6 +2716,17 @@ Description
Ignore all submissions posted before/after the submission with this ID.


extractor.reddit.previews
-------------------------
Type
``bool``
Default
``true``
Description
For failed downloads from external URLs / child extractors,
download Reddit's preview image/video if available.


extractor.reddit.recursion
--------------------------
Type
Expand Down
3 changes: 2 additions & 1 deletion gallery_dl/extractor/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def items(self):

parentdir = self.config("parent-directory")
max_depth = self.config("recursion", 0)
previews = self.config("previews", True)

videos = self.config("videos", True)
if videos:
Expand Down Expand Up @@ -119,7 +120,7 @@ def items(self):
if match:
extra.append(match.group(1))
elif not match_user(url) and not match_subreddit(url):
if "preview" in data:
if previews and "preview" in data:
data["_fallback"] = self._previews(data)
yield Message.Queue, text.unescape(url), data
if "_fallback" in data:
Expand Down

0 comments on commit 82296b1

Please sign in to comment.