[kemonoparty] restore using default creator posts endpoint
(#7438 #7450 #7462)
- revert c3fb0f53ee
- add '"endpoint": "legacy+"' option
to use '/posts-legacy' results and with full metadata
This commit is contained in:
@@ -317,16 +317,26 @@ class KemonopartyUserExtractor(KemonopartyExtractor):
|
||||
KemonopartyExtractor.__init__(self, match)
|
||||
|
||||
def posts(self):
|
||||
if self.config("endpoint") == "posts":
|
||||
endpoint = self.api.creator_posts
|
||||
else:
|
||||
endpoint = self.config("endpoint")
|
||||
if endpoint == "legacy":
|
||||
endpoint = self.api.creator_posts_legacy
|
||||
elif endpoint == "legacy+":
|
||||
endpoint = self._posts_legacy_plus
|
||||
else:
|
||||
endpoint = self.api.creator_posts
|
||||
|
||||
_, _, service, creator_id, query = self.groups
|
||||
params = text.parse_query(query)
|
||||
return endpoint(service, creator_id,
|
||||
params.get("o"), params.get("q"), params.get("tag"))
|
||||
|
||||
def _posts_legacy_plus(self, service, creator_id,
|
||||
offset=0, query=None, tags=None):
|
||||
for post in self.api.creator_posts_legacy(
|
||||
service, creator_id, offset, query, tags):
|
||||
yield self.api.creator_post(
|
||||
service, creator_id, post["id"])["post"]
|
||||
|
||||
|
||||
class KemonopartyPostsExtractor(KemonopartyExtractor):
|
||||
"""Extractor for kemono.su post listings"""
|
||||
|
||||
Reference in New Issue
Block a user