diff --git a/docs/configuration.rst b/docs/configuration.rst index 8fbfd81a..a53a7bd5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -4605,6 +4605,22 @@ Description Ignore all submissions posted before/after the submission with this ID. +extractor.reddit.limit +---------------------- +Type + ``integer`` +Default + ``null`` +Description + Number of results to return in a single API query. + + This value specifies the ``limit`` parameter + used for API requests when retrieving paginated results. + + ``null`` means not including this parameter at all + and letting Reddit chose a default. + + extractor.reddit.previews ------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 032337ac..b5dcb4b2 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -632,6 +632,7 @@ "date-format" : "%Y-%m-%dT%H:%M:%S", "id-min" : null, "id-max" : null, + "limit" : null, "previews" : true, "recursion" : 0, "selftext" : null, diff --git a/gallery_dl/extractor/reddit.py b/gallery_dl/extractor/reddit.py index dc167a35..2a1aed85 100644 --- a/gallery_dl/extractor/reddit.py +++ b/gallery_dl/extractor/reddit.py @@ -426,13 +426,11 @@ class RedditAPI(): def submissions_subreddit(self, subreddit, params): """Collect all (submission, comments)-tuples of a subreddit""" endpoint = subreddit + "/.json" - params["limit"] = 100 return self._pagination(endpoint, params) def submissions_user(self, user, params): """Collect all (submission, comments)-tuples posted by a user""" endpoint = "/user/" + user + "/.json" - params["limit"] = 100 return self._pagination(endpoint, params) def morechildren(self, link_id, children): @@ -532,6 +530,9 @@ class RedditAPI(): id_max = float("inf") date_min, date_max = self.extractor._get_date_min_max(0, 253402210800) + if limit := self.extractor.config("limit"): + params["limit"] = limit + while True: data = self._call(endpoint, params)["data"]