From 6d0a533d687e9fac92ad411b210f06a082a013d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 27 Sep 2019 23:11:28 +0200 Subject: [PATCH] [reddit] respect 'comments:0' for single submissions (#429) --- gallery_dl/extractor/reddit.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index a59a64b2..9c283de1 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -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"""