summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/redgifs.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-10-22 01:00:14 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-10-22 01:00:14 -0400
commite052f3b9e1d9703a5a466daeaf37bacf476c2daf (patch)
treefc608c7d452695706fb13e2b0b34671f569f3ab0 /gallery_dl/extractor/redgifs.py
parentb8758ecd073910ce3220b2e68399147b425c37b8 (diff)
New upstream version 1.26.1.upstream/1.26.1
Diffstat (limited to 'gallery_dl/extractor/redgifs.py')
-rw-r--r--gallery_dl/extractor/redgifs.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/gallery_dl/extractor/redgifs.py b/gallery_dl/extractor/redgifs.py
index e246405..6185acb 100644
--- a/gallery_dl/extractor/redgifs.py
+++ b/gallery_dl/extractor/redgifs.py
@@ -146,11 +146,17 @@ class RedgifsCollectionsExtractor(RedgifsExtractor):
class RedgifsNichesExtractor(RedgifsExtractor):
"""Extractor for redgifs niches"""
subcategory = "niches"
- pattern = r"(?:https?://)?(?:www\.)?redgifs\.com/niches/([^/?#]+)"
+ pattern = (r"(?:https?://)?(?:www\.)?redgifs\.com/niches/([^/?#]+)/?"
+ r"(?:\?([^#]+))?$")
example = "https://www.redgifs.com/niches/NAME"
+ def __init__(self, match):
+ RedgifsExtractor.__init__(self, match)
+ self.query = match.group(2)
+
def gifs(self):
- return self.api.niches(self.key)
+ order = text.parse_query(self.query).get("order")
+ return self.api.niches(self.key, order or "new")
class RedgifsSearchExtractor(RedgifsExtractor):
@@ -232,9 +238,10 @@ class RedgifsAPI():
endpoint = "/v2/users/{}/collections".format(user)
return self._pagination(endpoint, key="collections")
- def niches(self, niche):
+ def niches(self, niche, order):
endpoint = "/v2/niches/{}/gifs".format(niche)
- return self._pagination(endpoint)
+ params = {"count": 30, "order": order}
+ return self._pagination(endpoint, params)
def search(self, params):
endpoint = "/v2/gifs/search"