1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

[pixiv] add 'rating' metadata field (#595)

A human-friendlier representation of 'x_restrict'
This commit is contained in:
Mike Fährmann 2020-02-01 01:36:06 +01:00
parent dff33b260c
commit 91aaaf1a9e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -31,6 +31,7 @@ class PixivExtractor(Extractor):
self.load_ugoira = self.config("ugoira", True)
def items(self):
ratings = {0: "General", 1: "R-18", 2: "R-18G"}
metadata = self.get_metadata()
yield Message.Version, 1
@ -46,6 +47,7 @@ class PixivExtractor(Extractor):
work["num"] = 0
work["tags"] = [tag["name"] for tag in work["tags"]]
work["date"] = text.parse_datetime(work["create_date"])
work["rating"] = ratings.get(work["x_restrict"])
work["suffix"] = ""
work.update(metadata)