[booth:item] support URLs with language codes
This commit is contained in:
@@ -44,8 +44,9 @@ class BoothExtractor(Extractor):
|
|||||||
|
|
||||||
class BoothItemExtractor(BoothExtractor):
|
class BoothItemExtractor(BoothExtractor):
|
||||||
subcategory = "item"
|
subcategory = "item"
|
||||||
pattern = r"(?:https?://)?(?:[\w-]+\.)?booth\.pm/(?:\w\w/)?items/(\d+)"
|
pattern = (r"(?:https?://)?(?:[\w-]+\.)?booth\.pm/"
|
||||||
example = "https://booth.pm/items/12345"
|
r"(?:[a-z]{2}(?:-[^/?#]+)?/)?items/(\d+)")
|
||||||
|
example = "https://booth.pm/ja/items/12345"
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
url = f"{self.root}/ja/items/{self.groups[0]}"
|
url = f"{self.root}/ja/items/{self.groups[0]}"
|
||||||
@@ -108,7 +109,7 @@ class BoothItemExtractor(BoothExtractor):
|
|||||||
|
|
||||||
class BoothShopExtractor(BoothExtractor):
|
class BoothShopExtractor(BoothExtractor):
|
||||||
subcategory = "shop"
|
subcategory = "shop"
|
||||||
pattern = r"(?:https?://)?([\w-]+\.)booth\.pm/(?:\w\w/)?(?:items)?"
|
pattern = r"(?:https?://)?([\w-]+\.)booth\.pm/"
|
||||||
example = "https://SHOP.booth.pm/"
|
example = "https://SHOP.booth.pm/"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
|
|||||||
@@ -199,6 +199,12 @@ https://www.melonbooks.co.jp/detail/detail.php?product_id=1872452""",
|
|||||||
"_fallback": "len:3",
|
"_fallback": "len:3",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://booth.pm/zh-cn/items/1895090",
|
||||||
|
"#comment" : "URL with language code",
|
||||||
|
"#class" : booth.BoothItemExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://wanoazayaka.booth.pm/",
|
"#url" : "https://wanoazayaka.booth.pm/",
|
||||||
"#class" : booth.BoothShopExtractor,
|
"#class" : booth.BoothShopExtractor,
|
||||||
|
|||||||
Reference in New Issue
Block a user