From d5fa1d6aba3889021dbececbf489d87957e69c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 3 Nov 2024 09:21:39 +0100 Subject: [PATCH] [sankaku] improve tag categorization code translate tag type ID to name for each category instead of for each tag --- gallery_dl/extractor/sankaku.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gallery_dl/extractor/sankaku.py b/gallery_dl/extractor/sankaku.py index 7db81723..d5309dcd 100644 --- a/gallery_dl/extractor/sankaku.py +++ b/gallery_dl/extractor/sankaku.py @@ -76,14 +76,15 @@ class SankakuExtractor(BooruExtractor): def _tags(self, post, page): tags = collections.defaultdict(list) - types = self.TAG_TYPES for tag in post["tags"]: name = tag["name"] if name: - tags[types[tag["type"]]].append(name.lower().replace(" ", "_")) - for key, value in tags.items(): - post["tags_" + key] = value - post["tag_string_" + key] = " ".join(value) + tags[tag["type"]].append(name.lower().replace(" ", "_")) + types = self.TAG_TYPES + for type, values in tags.items(): + name = types[type] + post["tags_" + name] = values + post["tag_string_" + name] = " ".join(values) def _notes(self, post, page): if post.get("has_notes"):