[reddit] respect 'comments:0' for single submissions (#429)
This commit is contained in:
@@ -129,8 +129,15 @@ class RedditSubmissionExtractor(RedditExtractor):
|
||||
r"redd\.it"
|
||||
r")/([a-z0-9]+)")
|
||||
test = (
|
||||
("https://www.reddit.com/r/lavaporn/comments/2a00np/", {
|
||||
"pattern": r"https?://i\.imgur\.com/AaAUCgy\.jpg",
|
||||
("https://www.reddit.com/r/lavaporn/comments/8cqhub/", {
|
||||
"pattern": r"https://",
|
||||
"count": 3,
|
||||
}),
|
||||
# ignore submission comments (#429)
|
||||
("https://www.reddit.com/r/lavaporn/comments/8cqhub/", {
|
||||
"options": (("comments", 0),),
|
||||
"pattern": r"https://c2.staticflickr.com/8/7272/\w+_k.jpg",
|
||||
"count": 1,
|
||||
}),
|
||||
("https://old.reddit.com/r/lavaporn/comments/2a00np/"),
|
||||
("https://np.reddit.com/r/lavaporn/comments/2a00np/"),
|
||||
@@ -202,7 +209,7 @@ class RedditAPI():
|
||||
link_id = "t3_" + submission_id if self.morecomments else None
|
||||
submission, comments = self._call(endpoint, {"limit": self.comments})
|
||||
return (submission["data"]["children"][0]["data"],
|
||||
self._flatten(comments, link_id))
|
||||
self._flatten(comments, link_id) if self.comments else None)
|
||||
|
||||
def submissions_subreddit(self, subreddit, params):
|
||||
"""Collect all (submission, comments)-tuples of a subreddit"""
|
||||
|
||||
Reference in New Issue
Block a user