From a0b96bf0d6a4216111b50037d4b291a4af1d9668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 29 Jul 2025 20:16:58 +0200 Subject: [PATCH] [booth] extract 'shop[id]' & 'shop[uuid]' metadata (#7920) --- gallery_dl/extractor/booth.py | 11 +++++++++-- test/results/booth.py | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/booth.py b/gallery_dl/extractor/booth.py index ed044de8..8a8db507 100644 --- a/gallery_dl/extractor/booth.py +++ b/gallery_dl/extractor/booth.py @@ -56,8 +56,15 @@ class BoothItemExtractor(BoothExtractor): item["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z") item["tags"] = [t["name"] for t in item["tags"]] - files = self._extract_files(item) - item["count"] = len(files) + shop = item["shop"] + shop["id"] = text.parse_int(shop["thumbnail_url"].rsplit("/", 3)[1]) + + if files := self._extract_files(item): + item["count"] = len(files) + shop["uuid"] = files[0]["url"].split("/", 4)[3] + else: + item["count"] = 0 + shop["uuid"] = util.NONE yield Message.Directory, item for num, file in enumerate(files, 1): diff --git a/test/results/booth.py b/test/results/booth.py index 09f53f3c..b19dd3a7 100644 --- a/test/results/booth.py +++ b/test/results/booth.py @@ -69,6 +69,8 @@ https://www.melonbooks.co.jp/detail/detail.php?product_id=1872452""", }, "shipping_info" : "支払いから発送までの日数:4日以内", "shop" : { + "id" : 5742915, + "uuid" : "792d497b-6e82-4df3-86de-31577e10f476", "name" : "ふたりぼっちのSolitude", "subdomain" : "wanoazayaka", "thumbnail_url": "https://booth.pximg.net/c/48x48/users/5742915/icon_image/1448e5d8-f93f-445e-8e1e-acb29aa45aa4_base_resized.jpg", @@ -162,6 +164,8 @@ https://www.melonbooks.co.jp/detail/detail.php?product_id=1872452""", }, }, "shop" : { + "id" : 49832, + "uuid" : "74488d0d-e533-443c-82ce-fa961d5cbaf0", "name" : "CARAMEL CRUNCH!", "subdomain" : "caramel-crunch", "thumbnail_url": "https://booth.pximg.net/c/48x48/users/49832/icon_image/a240e313-6a0f-4155-8310-a0d6abb299e6_base_resized.jpg",