mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 12:12:34 +01:00
[pixiv] detect works requiring 'My pixiv' access
This commit is contained in:
parent
82269fdc09
commit
04df813e1b
@ -27,8 +27,8 @@ class PixivExtractor(Extractor):
|
|||||||
filename_fmt = "{id}_p{num}.{extension}"
|
filename_fmt = "{id}_p{num}.{extension}"
|
||||||
archive_fmt = "{id}{suffix}.{extension}"
|
archive_fmt = "{id}{suffix}.{extension}"
|
||||||
cookies_domain = None
|
cookies_domain = None
|
||||||
sanity_url = ("https://s.pximg.net/common/images"
|
sanity_url = "https://s.pximg.net/common/images/limit_sanity_level_360.png"
|
||||||
"/limit_sanity_level_360.png")
|
mypixiv_url = "https://s.pximg.net/common/images/limit_mypixiv_360.png"
|
||||||
|
|
||||||
def _init(self):
|
def _init(self):
|
||||||
self.api = PixivAppAPI(self)
|
self.api = PixivAppAPI(self)
|
||||||
@ -76,7 +76,8 @@ class PixivExtractor(Extractor):
|
|||||||
detail = self.api.illust_bookmark_detail(work["id"])
|
detail = self.api.illust_bookmark_detail(work["id"])
|
||||||
work["tags_bookmark"] = [tag["name"] for tag in detail["tags"]
|
work["tags_bookmark"] = [tag["name"] for tag in detail["tags"]
|
||||||
if tag["is_registered"]]
|
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"]))
|
body = self._request_ajax("/illust/" + str(work["id"]))
|
||||||
work["caption"] = text.unescape(body["illustComment"])
|
work["caption"] = text.unescape(body["illustComment"])
|
||||||
|
|
||||||
@ -122,6 +123,10 @@ class PixivExtractor(Extractor):
|
|||||||
self.log.warning(
|
self.log.warning(
|
||||||
"%s: Unable to download work ('sanity_level' warning)",
|
"%s: Unable to download work ('sanity_level' warning)",
|
||||||
work["id"])
|
work["id"])
|
||||||
|
elif url == self.mypixiv_url:
|
||||||
|
work["_mypixiv"] = True
|
||||||
|
self.log.warning("%s: 'My pixiv' locked", work["id"])
|
||||||
|
return ()
|
||||||
else:
|
else:
|
||||||
return ({"url": url},)
|
return ({"url": url},)
|
||||||
|
|
||||||
|
@ -329,14 +329,26 @@ __tests__ = (
|
|||||||
"#url" : "https://www.pixiv.net/en/users/173530/bookmarks/artworks",
|
"#url" : "https://www.pixiv.net/en/users/173530/bookmarks/artworks",
|
||||||
"#category": ("", "pixiv", "favorite"),
|
"#category": ("", "pixiv", "favorite"),
|
||||||
"#class" : pixiv.PixivFavoriteExtractor,
|
"#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",
|
"#url" : "https://www.pixiv.net/bookmark.php?id=173530",
|
||||||
"#category": ("", "pixiv", "favorite"),
|
"#category": ("", "pixiv", "favorite"),
|
||||||
"#class" : pixiv.PixivFavoriteExtractor,
|
"#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",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user