replace old %-formatted and .format(…) strings with f-strings (#7671)
mostly using flynt https://github.com/ikamensh/flynt
This commit is contained in:
@@ -135,9 +135,9 @@ class RedgifsCollectionsExtractor(RedgifsExtractor):
|
||||
example = "https://www.redgifs.com/users/USER/collections"
|
||||
|
||||
def items(self):
|
||||
base = f"{self.root}/users/{self.key}/collections/"
|
||||
for collection in self.api.collections(self.key):
|
||||
url = "{}/users/{}/collections/{}".format(
|
||||
self.root, self.key, collection["folderId"])
|
||||
url = f"{base}{collection['folderId']}"
|
||||
collection["_extractor"] = RedgifsCollectionExtractor
|
||||
yield Message.Queue, url, collection
|
||||
|
||||
@@ -223,25 +223,24 @@ class RedgifsAPI():
|
||||
return self._call(endpoint)
|
||||
|
||||
def user(self, user, order="new"):
|
||||
endpoint = "/v2/users/{}/search".format(user.lower())
|
||||
endpoint = f"/v2/users/{user.lower()}/search"
|
||||
params = {"order": order}
|
||||
return self._pagination(endpoint, params)
|
||||
|
||||
def collection(self, user, collection_id):
|
||||
endpoint = "/v2/users/{}/collections/{}/gifs".format(
|
||||
user, collection_id)
|
||||
endpoint = f"/v2/users/{user}/collections/{collection_id}/gifs"
|
||||
return self._pagination(endpoint)
|
||||
|
||||
def collection_info(self, user, collection_id):
|
||||
endpoint = "/v2/users/{}/collections/{}".format(user, collection_id)
|
||||
endpoint = f"/v2/users/{user}/collections/{collection_id}"
|
||||
return self._call(endpoint)
|
||||
|
||||
def collections(self, user):
|
||||
endpoint = "/v2/users/{}/collections".format(user)
|
||||
endpoint = f"/v2/users/{user}/collections"
|
||||
return self._pagination(endpoint, key="collections")
|
||||
|
||||
def niches(self, niche, order):
|
||||
endpoint = "/v2/niches/{}/gifs".format(niche)
|
||||
endpoint = f"/v2/niches/{niche}/gifs"
|
||||
params = {"count": 30, "order": order}
|
||||
return self._pagination(endpoint, params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user