mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[pixiv] allow downloading "original" ugoira frames (#6056)
This commit is contained in:
parent
ae9b0da755
commit
9d1e5f3c9b
@ -94,12 +94,39 @@ class PixivExtractor(Extractor):
|
||||
work.get("id"), exc.message)
|
||||
continue
|
||||
|
||||
url = ugoira["zip_urls"]["medium"].replace(
|
||||
"_ugoira600x600", "_ugoira1920x1080")
|
||||
work["frames"] = ugoira["frames"]
|
||||
url = ugoira["zip_urls"]["medium"]
|
||||
work["frames"] = frames = ugoira["frames"]
|
||||
work["date_url"] = self._date_from_url(url)
|
||||
work["_http_adjust_extension"] = False
|
||||
yield Message.Url, url, text.nameext_from_url(url, work)
|
||||
|
||||
if self.load_ugoira == "original":
|
||||
base, sep, _ = url.rpartition("_ugoira")
|
||||
base = base.replace(
|
||||
"/img-zip-ugoira/", "/img-original/", 1) + sep
|
||||
|
||||
for ext in ("jpg", "png", "gif"):
|
||||
try:
|
||||
url = ("{}0.{}".format(base, ext))
|
||||
self.request(url, method="HEAD")
|
||||
break
|
||||
except exception.HttpError:
|
||||
pass
|
||||
else:
|
||||
self.log.warning(
|
||||
"Unable to find Ugoira frame URLs (%s)",
|
||||
work.get("id"))
|
||||
continue
|
||||
|
||||
for num, frame in enumerate(frames):
|
||||
url = ("{}{}.{}".format(base, num, ext))
|
||||
work["num"] = num
|
||||
work["suffix"] = "_p{:02}".format(num)
|
||||
text.nameext_from_url(url, work)
|
||||
yield Message.Url, url, work
|
||||
|
||||
else:
|
||||
url = url.replace("_ugoira600x600", "_ugoira1920x1080")
|
||||
yield Message.Url, url, text.nameext_from_url(url, work)
|
||||
|
||||
elif work["page_count"] == 1:
|
||||
url = meta_single_page["original_image_url"]
|
||||
|
@ -146,13 +146,31 @@ __tests__ = (
|
||||
"#comment" : "ugoira",
|
||||
"#category": ("", "pixiv", "work"),
|
||||
"#class" : pixiv.PixivWorkExtractor,
|
||||
"#sha1_url": "7267695a985c4db8759bebcf8d21dbdd2d2317ef",
|
||||
"#urls" : "https://i.pximg.net/img-zip-ugoira/img/2018/01/15/13/24/48/66806629_ugoira1920x1080.zip",
|
||||
|
||||
"frames" : list,
|
||||
"date" : "dt:2018-01-14 15:06:08",
|
||||
"date_url": "dt:2018-01-15 04:24:48",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/artworks/101003492",
|
||||
"#comment" : "original ugoira frames (#6056)",
|
||||
"#category": ("", "pixiv", "work"),
|
||||
"#class" : pixiv.PixivWorkExtractor,
|
||||
"#options" : {"ugoira": "original"},
|
||||
"#urls" : [
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira0.png",
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira1.png",
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira2.png",
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira3.png",
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira4.png",
|
||||
"https://i.pximg.net/img-original/img/2022/09/04/23/54/19/101003492_ugoira5.png",
|
||||
],
|
||||
|
||||
"frames": list,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/artworks/966412",
|
||||
"#comment" : "related works (#1237)",
|
||||
|
Loading…
Reference in New Issue
Block a user