[redgifs] fix syntax for older Python versions
and update docs/supportedsites
This commit is contained in:
@@ -718,7 +718,7 @@ Consider all sites to be NSFW unless otherwise known.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>RedGIFs</td>
|
<td>RedGIFs</td>
|
||||||
<td>https://redgifs.com/</td>
|
<td>https://redgifs.com/</td>
|
||||||
<td>individual Images, Search Results, User Profiles</td>
|
<td>Collections, individual Images, Search Results, User Profiles</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class RedgifsCollectionExtractor(RedgifsExtractor):
|
|||||||
"""Extractor for an individual user collection"""
|
"""Extractor for an individual user collection"""
|
||||||
subcategory = "collection"
|
subcategory = "collection"
|
||||||
directory_fmt = ("{category}", "{userName}", "{folderName}")
|
directory_fmt = ("{category}", "{userName}", "{folderName}")
|
||||||
archive_fmt = "{collection_id}_{id}"
|
archive_fmt = "{folderId}_{id}"
|
||||||
pattern = (r"(?:https?://)?(?:www\.)?redgifs\.com/users"
|
pattern = (r"(?:https?://)?(?:www\.)?redgifs\.com/users"
|
||||||
r"/([^/?#]+)/collections/([^/?#]+)")
|
r"/([^/?#]+)/collections/([^/?#]+)")
|
||||||
test = (
|
test = (
|
||||||
@@ -114,11 +114,9 @@ class RedgifsCollectionExtractor(RedgifsExtractor):
|
|||||||
self.collection_id = match.group(2)
|
self.collection_id = match.group(2)
|
||||||
|
|
||||||
def metadata(self):
|
def metadata(self):
|
||||||
return {
|
data = {"userName": self.key}
|
||||||
"collection_id": self.collection_id,
|
data.update(self.api.collection_info(self.key, self.collection_id))
|
||||||
"userName": self.key,
|
return data
|
||||||
**self.api.collection_getInfo(self.key, self.collection_id),
|
|
||||||
}
|
|
||||||
|
|
||||||
def gifs(self):
|
def gifs(self):
|
||||||
return self.api.collection(self.key, self.collection_id)
|
return self.api.collection(self.key, self.collection_id)
|
||||||
@@ -191,6 +189,8 @@ class RedgifsImageExtractor(RedgifsExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class RedgifsAPI():
|
class RedgifsAPI():
|
||||||
|
"""https://api.redgifs.com/docs/index.html"""
|
||||||
|
|
||||||
API_ROOT = "https://api.redgifs.com"
|
API_ROOT = "https://api.redgifs.com"
|
||||||
|
|
||||||
def __init__(self, extractor):
|
def __init__(self, extractor):
|
||||||
@@ -212,15 +212,15 @@ class RedgifsAPI():
|
|||||||
params = {"order": order}
|
params = {"order": order}
|
||||||
return self._pagination(endpoint, params)
|
return self._pagination(endpoint, params)
|
||||||
|
|
||||||
def collection_getInfo(self, user, collection_id):
|
|
||||||
endpoint = "/v2/users/{}/collections/{}".format(user, collection_id)
|
|
||||||
return self._call(endpoint)
|
|
||||||
|
|
||||||
def collection(self, user, collection_id):
|
def collection(self, user, collection_id):
|
||||||
endpoint = "/v2/users/{}/collections/{}/gifs".format(
|
endpoint = "/v2/users/{}/collections/{}/gifs".format(
|
||||||
user, collection_id)
|
user, collection_id)
|
||||||
return self._pagination(endpoint)
|
return self._pagination(endpoint)
|
||||||
|
|
||||||
|
def collection_info(self, user, collection_id):
|
||||||
|
endpoint = "/v2/users/{}/collections/{}".format(user, collection_id)
|
||||||
|
return self._call(endpoint)
|
||||||
|
|
||||||
def collections(self, user):
|
def collections(self, user):
|
||||||
endpoint = "/v2/users/{}/collections".format(user)
|
endpoint = "/v2/users/{}/collections".format(user)
|
||||||
return self._pagination(endpoint, key="collections")
|
return self._pagination(endpoint, key="collections")
|
||||||
|
|||||||
@@ -212,6 +212,9 @@ SUBCATEGORY_MAP = {
|
|||||||
"reddit": {
|
"reddit": {
|
||||||
"home": "Home Feed",
|
"home": "Home Feed",
|
||||||
},
|
},
|
||||||
|
"redgifs": {
|
||||||
|
"collections": "",
|
||||||
|
},
|
||||||
"sankaku": {
|
"sankaku": {
|
||||||
"books": "Book Searches",
|
"books": "Book Searches",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user