diff --git a/docs/configuration.rst b/docs/configuration.rst index 3c32ab87..4d7dded4 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -5435,6 +5435,16 @@ Note but it will not always get the best video quality available. +extractor.reddit.user.only +-------------------------- +Type + ``bool`` +Default + ``trur`` +Description + Only process and return posts from the user specified in the input URL. + + extractor.redgifs.format ------------------------ Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 62bfc4f6..052e4214 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -707,7 +707,11 @@ "previews" : true, "recursion" : 0, "selftext" : null, - "videos" : "dash" + "videos" : "dash", + + "user": { + "only": true + } }, "redgifs": { diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index 8d992628..7ec2377f 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -317,8 +317,23 @@ class RedditUserExtractor(RedditExtractor): submissions = self.api.submissions_user( user["name"], text.parse_query(qs)) + if self.config("only", True): + submissions = self._only(submissions, user) return submissions + def _only(self, submissions, user): + uid = "t2_" + user["id"] + for submission, comments in submissions: + if submission and submission.get("author_fullname") != uid: + submission = None + comments = [ + comment + for comment in (comments or ()) + if comment.get("author_fullname") == uid + ] + if submission or comments: + yield submission, comments + class RedditSubmissionExtractor(RedditExtractor): """Extractor for URLs from a submission on reddit.com"""