[kemonoparty] add 'endpoint' option (#7438)
This commit is contained in:
@@ -317,11 +317,15 @@ class KemonopartyUserExtractor(KemonopartyExtractor):
|
||||
KemonopartyExtractor.__init__(self, match)
|
||||
|
||||
def posts(self):
|
||||
if self.config("endpoint") == "posts":
|
||||
endpoint = self.api.creator_posts
|
||||
else:
|
||||
endpoint = self.api.creator_posts_legacy
|
||||
|
||||
_, _, service, creator_id, query = self.groups
|
||||
params = text.parse_query(query)
|
||||
return self.api.creator_posts_legacy(
|
||||
service, creator_id,
|
||||
params.get("o"), params.get("q"), params.get("tag"))
|
||||
return endpoint(service, creator_id,
|
||||
params.get("o"), params.get("q"), params.get("tag"))
|
||||
|
||||
|
||||
class KemonopartyPostsExtractor(KemonopartyExtractor):
|
||||
@@ -525,9 +529,10 @@ class KemonoAPI():
|
||||
endpoint = "/file/" + file_hash
|
||||
return self._call(endpoint)
|
||||
|
||||
def creator_posts(self, service, creator_id, offset=0, query=None):
|
||||
def creator_posts(self, service, creator_id,
|
||||
offset=0, query=None, tags=None):
|
||||
endpoint = "/{}/user/{}".format(service, creator_id)
|
||||
params = {"q": query, "o": offset}
|
||||
params = {"q": query, "tag": tags, "o": offset}
|
||||
return self._pagination(endpoint, params, 50)
|
||||
|
||||
def creator_posts_legacy(self, service, creator_id,
|
||||
|
||||
Reference in New Issue
Block a user