From d8128fbd4c861ce3e45730a45419fa515d8e2c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 11 Jan 2026 22:17:36 +0100 Subject: [PATCH] [booth:item] support URLs with language codes --- gallery_dl/extractor/booth.py | 7 ++++--- test/results/booth.py | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/booth.py b/gallery_dl/extractor/booth.py index b62c5eba..20c16aa2 100644 --- a/gallery_dl/extractor/booth.py +++ b/gallery_dl/extractor/booth.py @@ -44,8 +44,9 @@ class BoothExtractor(Extractor): class BoothItemExtractor(BoothExtractor): subcategory = "item" - pattern = r"(?:https?://)?(?:[\w-]+\.)?booth\.pm/(?:\w\w/)?items/(\d+)" - example = "https://booth.pm/items/12345" + pattern = (r"(?:https?://)?(?:[\w-]+\.)?booth\.pm/" + r"(?:[a-z]{2}(?:-[^/?#]+)?/)?items/(\d+)") + example = "https://booth.pm/ja/items/12345" def items(self): url = f"{self.root}/ja/items/{self.groups[0]}" @@ -108,7 +109,7 @@ class BoothItemExtractor(BoothExtractor): class BoothShopExtractor(BoothExtractor): subcategory = "shop" - pattern = r"(?:https?://)?([\w-]+\.)booth\.pm/(?:\w\w/)?(?:items)?" + pattern = r"(?:https?://)?([\w-]+\.)booth\.pm/" example = "https://SHOP.booth.pm/" def __init__(self, match): diff --git a/test/results/booth.py b/test/results/booth.py index 9fadf3b4..140ab770 100644 --- a/test/results/booth.py +++ b/test/results/booth.py @@ -199,6 +199,12 @@ https://www.melonbooks.co.jp/detail/detail.php?product_id=1872452""", "_fallback": "len:3", }, +{ + "#url" : "https://booth.pm/zh-cn/items/1895090", + "#comment" : "URL with language code", + "#class" : booth.BoothItemExtractor, +}, + { "#url" : "https://wanoazayaka.booth.pm/", "#class" : booth.BoothShopExtractor,