1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[reddit] add 'embeds' option (#6357)

This commit is contained in:
Mike Fährmann 2024-10-22 17:03:11 +02:00
parent 33161da121
commit b08da4ffc7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 20 additions and 2 deletions

View File

@ -3702,6 +3702,16 @@ Description
Note: This requires 1 additional API call for every 100 extra comments.
extractor.reddit.embeds
-----------------------
Type
``bool``
Default
``true``
Description
Download embedded comments media.
extractor.reddit.date-min & .date-max
-------------------------------------
Type

View File

@ -31,6 +31,7 @@ class RedditExtractor(Extractor):
parentdir = self.config("parent-directory")
max_depth = self.config("recursion", 0)
previews = self.config("previews", True)
embeds = self.config("embeds", True)
videos = self.config("videos", True)
if videos:
@ -100,7 +101,7 @@ class RedditExtractor(Extractor):
for comment in comments:
html = comment["body_html"] or ""
href = (' href="' in html)
media = ("media_metadata" in comment)
media = (embeds and "media_metadata" in comment)
if media or href:
comment["date"] = text.parse_timestamp(

View File

@ -171,7 +171,6 @@ __tests__ = (
{
"#url" : "https://www.reddit.com/r/RobloxArt/comments/15ko0qu/",
"#comment" : "comment embeds (#5366)",
"#category": ("", "reddit", "submission"),
"#class" : reddit.RedditSubmissionExtractor,
"#options" : {"comments": 10},
"#urls" : (
@ -180,6 +179,14 @@ __tests__ = (
),
},
{
"#url" : "https://www.reddit.com/r/RobloxArt/comments/15ko0qu/",
"#comment" : "disabled comment embeds (#6357)",
"#class" : reddit.RedditSubmissionExtractor,
"#options" : {"comments": 10, "embeds": False},
"#urls" : "https://i.redd.it/ppt5yciyipgb1.jpg",
},
{
"#url" : "https://www.reddit.com/user/TheSpiritTree/comments/srilyf/",
"#comment" : "user page submission (#2301)",