mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-26 04:32:51 +01:00
[danbooru] fix ugoira metadata extraction (#3056)
This commit is contained in:
parent
096b8f2cfc
commit
d0d4ce1a13
@ -88,10 +88,7 @@ class DanbooruExtractor(BaseExtractor):
|
||||
|
||||
if post["extension"] == "zip":
|
||||
if self.ugoira:
|
||||
post["frames"] = self.request(
|
||||
"{}/posts/{}.json?only=pixiv_ugoira_frame_data".format(
|
||||
self.root, post["id"])
|
||||
).json()["pixiv_ugoira_frame_data"]["data"]
|
||||
post["frames"] = self._ugoira_frames(post)
|
||||
post["_http_adjust_extension"] = False
|
||||
else:
|
||||
url = post["large_file_url"]
|
||||
@ -139,6 +136,18 @@ class DanbooruExtractor(BaseExtractor):
|
||||
else:
|
||||
return
|
||||
|
||||
def _ugoira_frames(self, post):
|
||||
data = self.request("{}/posts/{}.json?only=media_metadata".format(
|
||||
self.root, post["id"])
|
||||
).json()["media_metadata"]["metadata"]
|
||||
|
||||
ext = data["ZIP:ZipFileName"].rpartition(".")[2]
|
||||
print(post["id"], ext)
|
||||
fmt = ("{:>06}." + ext).format
|
||||
delays = data["Ugoira:FrameDelays"]
|
||||
return [{"file": fmt(index), "delay": delay}
|
||||
for index, delay in enumerate(delays)]
|
||||
|
||||
|
||||
INSTANCES = {
|
||||
"danbooru": {
|
||||
|
Loading…
Reference in New Issue
Block a user