[pixiv] extend 'metadata' option (#3057)
make it usable for all 'pixiv' extractors
This commit is contained in:
@@ -1971,8 +1971,8 @@ Description
|
|||||||
It is possible to use ``"all"`` instead of listing all values separately.
|
It is possible to use ``"all"`` instead of listing all values separately.
|
||||||
|
|
||||||
|
|
||||||
extractor.pixiv.artworks.metadata
|
extractor.pixiv.metadata
|
||||||
---------------------------------
|
------------------------
|
||||||
Type
|
Type
|
||||||
``bool``
|
``bool``
|
||||||
Default
|
Default
|
||||||
|
|||||||
@@ -230,6 +230,7 @@
|
|||||||
{
|
{
|
||||||
"refresh-token": null,
|
"refresh-token": null,
|
||||||
"include": "artworks",
|
"include": "artworks",
|
||||||
|
"metadata": false,
|
||||||
"tags": "japanese",
|
"tags": "japanese",
|
||||||
"ugoira": true
|
"ugoira": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class PixivExtractor(Extractor):
|
|||||||
work["tags"] = [tag["name"] for tag in work["tags"]]
|
work["tags"] = [tag["name"] for tag in work["tags"]]
|
||||||
|
|
||||||
ratings = {0: "General", 1: "R-18", 2: "R-18G"}
|
ratings = {0: "General", 1: "R-18", 2: "R-18G"}
|
||||||
|
userdata = self.config("metadata")
|
||||||
metadata = self.metadata()
|
metadata = self.metadata()
|
||||||
|
|
||||||
works = self.works()
|
works = self.works()
|
||||||
@@ -60,6 +61,8 @@ class PixivExtractor(Extractor):
|
|||||||
del work["image_urls"]
|
del work["image_urls"]
|
||||||
del work["meta_pages"]
|
del work["meta_pages"]
|
||||||
|
|
||||||
|
if userdata:
|
||||||
|
work.update(self.api.user_detail(work["user"]["id"]))
|
||||||
if transform_tags:
|
if transform_tags:
|
||||||
transform_tags(work)
|
transform_tags(work)
|
||||||
work["num"] = 0
|
work["num"] = 0
|
||||||
@@ -198,7 +201,7 @@ class PixivArtworksExtractor(PixivExtractor):
|
|||||||
|
|
||||||
def metadata(self):
|
def metadata(self):
|
||||||
if self.config("metadata"):
|
if self.config("metadata"):
|
||||||
return self.api.user_detail(self.user_id)
|
self.api.user_detail(self.user_id)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def works(self):
|
def works(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user