[booth:item] support URLs with language codes

This commit is contained in:
Mike Fährmann
2026-01-11 22:17:36 +01:00
parent d7c1c30c62
commit d8128fbd4c
2 changed files with 10 additions and 3 deletions

View File

@@ -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):

View File

@@ -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,