[pixiv] fix errors when using metadata options for avatar/background
(#9002)
This commit is contained in:
@@ -376,6 +376,8 @@ class PixivExtractor(Extractor):
|
|||||||
"meta_single_page": {"original_image_url": url},
|
"meta_single_page": {"original_image_url": url},
|
||||||
"page_count" : 1,
|
"page_count" : 1,
|
||||||
"sanity_level" : 0,
|
"sanity_level" : 0,
|
||||||
|
"total_comments" : 0,
|
||||||
|
"is_bookmarked" : False,
|
||||||
"tags" : (),
|
"tags" : (),
|
||||||
"title" : kind,
|
"title" : kind,
|
||||||
"type" : kind,
|
"type" : kind,
|
||||||
@@ -520,7 +522,10 @@ class PixivAvatarExtractor(PixivExtractor):
|
|||||||
|
|
||||||
def _init(self):
|
def _init(self):
|
||||||
PixivExtractor._init(self)
|
PixivExtractor._init(self)
|
||||||
self.sanity_workaround = self.meta_comments = False
|
self.sanity_workaround = \
|
||||||
|
self.meta_bookmark = \
|
||||||
|
self.meta_comments = \
|
||||||
|
self.meta_captions = False
|
||||||
|
|
||||||
def works(self):
|
def works(self):
|
||||||
user = self.api.user_detail(self.groups[0])["user"]
|
user = self.api.user_detail(self.groups[0])["user"]
|
||||||
@@ -536,9 +541,7 @@ class PixivBackgroundExtractor(PixivExtractor):
|
|||||||
pattern = USER_PATTERN + "/background"
|
pattern = USER_PATTERN + "/background"
|
||||||
example = "https://www.pixiv.net/en/users/12345/background"
|
example = "https://www.pixiv.net/en/users/12345/background"
|
||||||
|
|
||||||
def _init(self):
|
_init = PixivAvatarExtractor._init
|
||||||
PixivExtractor._init(self)
|
|
||||||
self.sanity_workaround = self.meta_comments = False
|
|
||||||
|
|
||||||
def works(self):
|
def works(self):
|
||||||
detail = self.api.user_detail(self.groups[0])
|
detail = self.api.user_detail(self.groups[0])
|
||||||
|
|||||||
@@ -211,12 +211,24 @@ __tests__ = (
|
|||||||
{
|
{
|
||||||
"#url" : "https://www.pixiv.net/en/users/173530/avatar",
|
"#url" : "https://www.pixiv.net/en/users/173530/avatar",
|
||||||
"#class" : pixiv.PixivAvatarExtractor,
|
"#class" : pixiv.PixivAvatarExtractor,
|
||||||
|
"#options" : {
|
||||||
|
"metadata" : True,
|
||||||
|
"metadata-bookmark": True,
|
||||||
|
"captions" : True,
|
||||||
|
"comments" : True,
|
||||||
|
},
|
||||||
"#sha1_content": "4e57544480cc2036ea9608103e8f024fa737fe66",
|
"#sha1_content": "4e57544480cc2036ea9608103e8f024fa737fe66",
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://www.pixiv.net/en/users/194921/background",
|
"#url" : "https://www.pixiv.net/en/users/194921/background",
|
||||||
"#class" : pixiv.PixivBackgroundExtractor,
|
"#class" : pixiv.PixivBackgroundExtractor,
|
||||||
|
"#options" : {
|
||||||
|
"metadata" : True,
|
||||||
|
"metadata-bookmark": True,
|
||||||
|
"captions" : True,
|
||||||
|
"comments" : True,
|
||||||
|
},
|
||||||
"#pattern" : r"https://i\.pximg\.net/background/img/2021/01/30/16/12/02/194921_af1f71e557a42f499213d4b9eaccc0f8\.jpg",
|
"#pattern" : r"https://i\.pximg\.net/background/img/2021/01/30/16/12/02/194921_af1f71e557a42f499213d4b9eaccc0f8\.jpg",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user