mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-26 04:32:51 +01:00
commit
727c8eec6c
@ -146,11 +146,17 @@ class RedgifsCollectionsExtractor(RedgifsExtractor):
|
|||||||
class RedgifsNichesExtractor(RedgifsExtractor):
|
class RedgifsNichesExtractor(RedgifsExtractor):
|
||||||
"""Extractor for redgifs niches"""
|
"""Extractor for redgifs niches"""
|
||||||
subcategory = "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"
|
example = "https://www.redgifs.com/niches/NAME"
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
RedgifsExtractor.__init__(self, match)
|
||||||
|
self.query = match.group(2)
|
||||||
|
|
||||||
def gifs(self):
|
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):
|
class RedgifsSearchExtractor(RedgifsExtractor):
|
||||||
@ -232,9 +238,10 @@ class RedgifsAPI():
|
|||||||
endpoint = "/v2/users/{}/collections".format(user)
|
endpoint = "/v2/users/{}/collections".format(user)
|
||||||
return self._pagination(endpoint, key="collections")
|
return self._pagination(endpoint, key="collections")
|
||||||
|
|
||||||
def niches(self, niche):
|
def niches(self, niche, order):
|
||||||
endpoint = "/v2/niches/{}/gifs".format(niche)
|
endpoint = "/v2/niches/{}/gifs".format(niche)
|
||||||
return self._pagination(endpoint)
|
params = {"count": 30, "order": order}
|
||||||
|
return self._pagination(endpoint, params)
|
||||||
|
|
||||||
def search(self, params):
|
def search(self, params):
|
||||||
endpoint = "/v2/gifs/search"
|
endpoint = "/v2/gifs/search"
|
||||||
|
@ -67,19 +67,19 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.redgifs.com/niches/boobs",
|
"#url" : "https://www.redgifs.com/niches/just-boobs",
|
||||||
"#category": ("", "redgifs", "niches"),
|
"#category": ("", "redgifs", "niches"),
|
||||||
"#class" : redgifs.RedgifsNichesExtractor,
|
"#class" : redgifs.RedgifsNichesExtractor,
|
||||||
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.mp4",
|
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.(mp4|jpg)",
|
||||||
"#range" : "1-20",
|
"#range" : "1-20",
|
||||||
"#count" : 20,
|
"#count" : 20,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.redgifs.com/niches/ass",
|
"#url" : "https://www.redgifs.com/niches/thick-booty",
|
||||||
"#category": ("", "redgifs", "niches"),
|
"#category": ("", "redgifs", "niches"),
|
||||||
"#class" : redgifs.RedgifsNichesExtractor,
|
"#class" : redgifs.RedgifsNichesExtractor,
|
||||||
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.mp4",
|
"#pattern" : r"https://\w+\.redgifs\.com/[\w-]+\.(mp4|jpg)",
|
||||||
"#range" : "1-20",
|
"#range" : "1-20",
|
||||||
"#count" : 20,
|
"#count" : 20,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user