[reddit] add 'previews' option (#4322)

another way to disable this new behavior
This commit is contained in:
Mike Fährmann
2023-09-22 18:10:44 +02:00
parent 918ba4f847
commit 82296b1f05
2 changed files with 13 additions and 1 deletions

View File

@@ -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

View File

@@ -30,6 +30,7 @@ class RedditExtractor(Extractor):
parentdir = self.config("parent-directory")
max_depth = self.config("recursion", 0)
previews = self.config("previews", True)
videos = self.config("videos", True)
if videos:
@@ -119,7 +120,7 @@ class RedditExtractor(Extractor):
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: