1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[pixiv] detect works requiring 'My pixiv' access

This commit is contained in:
Mike Fährmann 2024-10-10 15:04:42 +02:00
parent 82269fdc09
commit 04df813e1b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 22 additions and 5 deletions

View File

@ -27,8 +27,8 @@ class PixivExtractor(Extractor):
filename_fmt = "{id}_p{num}.{extension}"
archive_fmt = "{id}{suffix}.{extension}"
cookies_domain = None
sanity_url = ("https://s.pximg.net/common/images"
"/limit_sanity_level_360.png")
sanity_url = "https://s.pximg.net/common/images/limit_sanity_level_360.png"
mypixiv_url = "https://s.pximg.net/common/images/limit_mypixiv_360.png"
def _init(self):
self.api = PixivAppAPI(self)
@ -76,7 +76,8 @@ class PixivExtractor(Extractor):
detail = self.api.illust_bookmark_detail(work["id"])
work["tags_bookmark"] = [tag["name"] for tag in detail["tags"]
if tag["is_registered"]]
if self.sanity_workaround and not work.get("caption"):
if self.sanity_workaround and not work.get("caption") and \
not work.get("_mypixiv"):
body = self._request_ajax("/illust/" + str(work["id"]))
work["caption"] = text.unescape(body["illustComment"])
@ -122,6 +123,10 @@ class PixivExtractor(Extractor):
self.log.warning(
"%s: Unable to download work ('sanity_level' warning)",
work["id"])
elif url == self.mypixiv_url:
work["_mypixiv"] = True
self.log.warning("%s: 'My pixiv' locked", work["id"])
return ()
else:
return ({"url": url},)

View File

@ -329,14 +329,26 @@ __tests__ = (
"#url" : "https://www.pixiv.net/en/users/173530/bookmarks/artworks",
"#category": ("", "pixiv", "favorite"),
"#class" : pixiv.PixivFavoriteExtractor,
"#sha1_url": "85a3104eaaaf003c7b3947117ca2f1f0b1cfc949",
"#urls" : [
"https://i.pximg.net/img-original/img/2008/10/31/17/54/01/2005108_p0.jpg",
"https://i.pximg.net/img-original/img/2008/09/27/12/22/40/1719386_p0.jpg",
"https://i.pximg.net/img-original/img/2008/04/15/01/43/46/669358_p0.jpg",
"https://i.pximg.net/img-original/img/2008/06/19/21/52/15/1005851_p0.jpg",
"https://i.pximg.net/img-original/img/2008/06/17/22/16/54/994965_p0.jpg",
],
},
{
"#url" : "https://www.pixiv.net/bookmark.php?id=173530",
"#category": ("", "pixiv", "favorite"),
"#class" : pixiv.PixivFavoriteExtractor,
"#sha1_url": "85a3104eaaaf003c7b3947117ca2f1f0b1cfc949",
"#urls" : [
"https://i.pximg.net/img-original/img/2008/10/31/17/54/01/2005108_p0.jpg",
"https://i.pximg.net/img-original/img/2008/09/27/12/22/40/1719386_p0.jpg",
"https://i.pximg.net/img-original/img/2008/04/15/01/43/46/669358_p0.jpg",
"https://i.pximg.net/img-original/img/2008/06/19/21/52/15/1005851_p0.jpg",
"https://i.pximg.net/img-original/img/2008/06/17/22/16/54/994965_p0.jpg",
],
},
{