aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/pixiv.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-05-26 06:46:00 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-05-26 06:46:00 -0400
commit6424318a059207759b9055cf8a8df91c0ddac7c8 (patch)
tree3fb8adec807ad1ffeba4889a506b05e680ca8051 /gallery_dl/extractor/pixiv.py
parent2bef55427baa34bf0f78d52590bbf27b2c5f3a56 (diff)
parent7672a750cb74bf31e21d76aad2776367fd476155 (diff)
Update upstream source from tag 'upstream/1.29.7'
Update to upstream version '1.29.7' with Debian dir 264267cd1ebd5c7205fe1f137a394d0ae1a2fb3b
Diffstat (limited to 'gallery_dl/extractor/pixiv.py')
-rw-r--r--gallery_dl/extractor/pixiv.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py
index c063216..73c5c1c 100644
--- a/gallery_dl/extractor/pixiv.py
+++ b/gallery_dl/extractor/pixiv.py
@@ -136,7 +136,21 @@ class PixivExtractor(Extractor):
self.log.warning("%s: 'limit_sanity_level' warning", work_id)
if self.sanity_workaround:
body = self._request_ajax("/illust/" + str(work_id))
- return self._extract_ajax(work, body)
+ if work["type"] == "ugoira":
+ if not self.load_ugoira:
+ return ()
+ self.log.info("%s: Retrieving Ugoira AJAX metadata",
+ work["id"])
+ try:
+ self._extract_ajax(work, body)
+ return self._extract_ugoira(work, url)
+ except Exception as exc:
+ self.log.debug("", exc_info=exc)
+ self.log.warning(
+ "%s: Unable to extract Ugoira URL. Provide "
+ "logged-in cookies to access it", work["id"])
+ else:
+ return self._extract_ajax(work, body)
elif limit_type == "limit_mypixiv_360.png":
work["_mypixiv"] = True
@@ -161,7 +175,12 @@ class PixivExtractor(Extractor):
return ()
def _extract_ugoira(self, work, img_url):
- ugoira = self.api.ugoira_metadata(work["id"])
+ if work.get("_ajax"):
+ ugoira = self._request_ajax(
+ "/illust/" + str(work["id"]) + "/ugoira_meta")
+ img_url = ugoira["src"]
+ else:
+ ugoira = self.api.ugoira_metadata(work["id"])
work["_ugoira_frame_data"] = work["frames"] = frames = ugoira["frames"]
work["_ugoira_original"] = self.load_ugoira_original
work["_http_adjust_extension"] = False
@@ -198,7 +217,10 @@ class PixivExtractor(Extractor):
]
else:
- zip_url = ugoira["zip_urls"]["medium"]
+ if work.get("_ajax"):
+ zip_url = ugoira["originalSrc"]
+ else:
+ zip_url = ugoira["zip_urls"]["medium"]
work["date_url"] = self._date_from_url(zip_url)
url = zip_url.replace("_ugoira600x600", "_ugoira1920x1080", 1)
return ({"url": url},)