mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
parent
6e830ffc9e
commit
0d52b775cb
@ -2072,7 +2072,19 @@ Type
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
Extract ``username`` metadata
|
||||
Extract ``username`` metadata.
|
||||
|
||||
|
||||
extractor.kemonoparty.revisions
|
||||
-------------------------------
|
||||
Type
|
||||
``bool``
|
||||
Default
|
||||
``false``
|
||||
Description
|
||||
Extract post revisions.
|
||||
|
||||
Note: This requires 1 additional HTTP request per post.
|
||||
|
||||
|
||||
extractor.khinsider.format
|
||||
|
@ -239,9 +239,23 @@ class KemonopartyUserExtractor(KemonopartyExtractor):
|
||||
url = self.api_url
|
||||
params = text.parse_query(self.query)
|
||||
params["o"] = text.parse_int(params.get("o"))
|
||||
revisions = self.config("revisions")
|
||||
|
||||
while True:
|
||||
posts = self.request(url, params=params).json()
|
||||
|
||||
if revisions:
|
||||
for post in posts:
|
||||
post["revision_id"] = 0
|
||||
yield post
|
||||
post_url = "{}/post/{}".format(self.api_url, post["id"])
|
||||
try:
|
||||
revs = self._post_revisions(post_url)
|
||||
except exception.HttpError:
|
||||
pass
|
||||
else:
|
||||
yield from revs
|
||||
else:
|
||||
yield from posts
|
||||
|
||||
if len(posts) < 50:
|
||||
@ -266,7 +280,16 @@ class KemonopartyPostExtractor(KemonopartyExtractor):
|
||||
|
||||
def posts(self):
|
||||
if not self.revision:
|
||||
return (self.request(self.api_url).json(),)
|
||||
post = self.request(self.api_url).json()
|
||||
if self.config("revisions"):
|
||||
post["revision_id"] = 0
|
||||
try:
|
||||
revs = self._post_revisions(self.api_url)
|
||||
except exception.HttpError:
|
||||
pass
|
||||
else:
|
||||
return itertools.chain((post,), revs)
|
||||
return (post,)
|
||||
|
||||
revs = self._post_revisions(self.api_url)
|
||||
if not self.revision_id:
|
||||
|
Loading…
Reference in New Issue
Block a user