[reddit] add 'embeds' option (#6357)
This commit is contained in:
@@ -3702,6 +3702,16 @@ Description
|
|||||||
Note: This requires 1 additional API call for every 100 extra comments.
|
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
|
extractor.reddit.date-min & .date-max
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class RedditExtractor(Extractor):
|
|||||||
parentdir = self.config("parent-directory")
|
parentdir = self.config("parent-directory")
|
||||||
max_depth = self.config("recursion", 0)
|
max_depth = self.config("recursion", 0)
|
||||||
previews = self.config("previews", True)
|
previews = self.config("previews", True)
|
||||||
|
embeds = self.config("embeds", True)
|
||||||
|
|
||||||
videos = self.config("videos", True)
|
videos = self.config("videos", True)
|
||||||
if videos:
|
if videos:
|
||||||
@@ -100,7 +101,7 @@ class RedditExtractor(Extractor):
|
|||||||
for comment in comments:
|
for comment in comments:
|
||||||
html = comment["body_html"] or ""
|
html = comment["body_html"] or ""
|
||||||
href = (' href="' in html)
|
href = (' href="' in html)
|
||||||
media = ("media_metadata" in comment)
|
media = (embeds and "media_metadata" in comment)
|
||||||
|
|
||||||
if media or href:
|
if media or href:
|
||||||
comment["date"] = text.parse_timestamp(
|
comment["date"] = text.parse_timestamp(
|
||||||
|
|||||||
@@ -171,7 +171,6 @@ __tests__ = (
|
|||||||
{
|
{
|
||||||
"#url" : "https://www.reddit.com/r/RobloxArt/comments/15ko0qu/",
|
"#url" : "https://www.reddit.com/r/RobloxArt/comments/15ko0qu/",
|
||||||
"#comment" : "comment embeds (#5366)",
|
"#comment" : "comment embeds (#5366)",
|
||||||
"#category": ("", "reddit", "submission"),
|
|
||||||
"#class" : reddit.RedditSubmissionExtractor,
|
"#class" : reddit.RedditSubmissionExtractor,
|
||||||
"#options" : {"comments": 10},
|
"#options" : {"comments": 10},
|
||||||
"#urls" : (
|
"#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/",
|
"#url" : "https://www.reddit.com/user/TheSpiritTree/comments/srilyf/",
|
||||||
"#comment" : "user page submission (#2301)",
|
"#comment" : "user page submission (#2301)",
|
||||||
|
|||||||
Reference in New Issue
Block a user