[booth:item] support URLs with language codes
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user