[gelbooru] support 'all' and empty tag (#5076)
This commit is contained in:
@@ -118,7 +118,7 @@ class GelbooruBase():
|
|||||||
class GelbooruTagExtractor(GelbooruBase,
|
class GelbooruTagExtractor(GelbooruBase,
|
||||||
gelbooru_v02.GelbooruV02TagExtractor):
|
gelbooru_v02.GelbooruV02TagExtractor):
|
||||||
"""Extractor for images from gelbooru.com based on search-tags"""
|
"""Extractor for images from gelbooru.com based on search-tags"""
|
||||||
pattern = BASE_PATTERN + r"page=post&s=list&tags=([^&#]+)"
|
pattern = BASE_PATTERN + r"page=post&s=list&tags=([^&#]*)"
|
||||||
example = "https://gelbooru.com/index.php?page=post&s=list&tags=TAG"
|
example = "https://gelbooru.com/index.php?page=post&s=list&tags=TAG"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class GelbooruV02TagExtractor(GelbooruV02Extractor):
|
|||||||
subcategory = "tag"
|
subcategory = "tag"
|
||||||
directory_fmt = ("{category}", "{search_tags}")
|
directory_fmt = ("{category}", "{search_tags}")
|
||||||
archive_fmt = "t_{search_tags}_{id}"
|
archive_fmt = "t_{search_tags}_{id}"
|
||||||
pattern = BASE_PATTERN + r"/index\.php\?page=post&s=list&tags=([^&#]+)"
|
pattern = BASE_PATTERN + r"/index\.php\?page=post&s=list&tags=([^&#]*)"
|
||||||
example = "https://safebooru.org/index.php?page=post&s=list&tags=TAG"
|
example = "https://safebooru.org/index.php?page=post&s=list&tags=TAG"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@@ -202,6 +202,8 @@ class GelbooruV02TagExtractor(GelbooruV02Extractor):
|
|||||||
return {"search_tags": self.tags}
|
return {"search_tags": self.tags}
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
|
if self.tags == "all":
|
||||||
|
self.tags = ""
|
||||||
return self._pagination({"tags": self.tags})
|
return self._pagination({"tags": self.tags})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,20 @@ __tests__ = (
|
|||||||
"#count" : 5,
|
"#count" : 5,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://gelbooru.com/index.php?page=post&s=list&tags=all",
|
||||||
|
"#category": ("booru", "gelbooru", "tag"),
|
||||||
|
"#class" : gelbooru.GelbooruTagExtractor,
|
||||||
|
"#range" : "1-3",
|
||||||
|
"#count" : 3,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://gelbooru.com/index.php?page=post&s=list&tags=",
|
||||||
|
"#category": ("booru", "gelbooru", "tag"),
|
||||||
|
"#class" : gelbooru.GelbooruTagExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://gelbooru.com/index.php?page=post&s=list&tags=meiya_neon",
|
"#url" : "https://gelbooru.com/index.php?page=post&s=list&tags=meiya_neon",
|
||||||
"#category": ("booru", "gelbooru", "tag"),
|
"#category": ("booru", "gelbooru", "tag"),
|
||||||
|
|||||||
@@ -16,6 +16,20 @@ __tests__ = (
|
|||||||
"#sha1_content": "e5ad4c5bf241b1def154958535bef6c2f6b733eb",
|
"#sha1_content": "e5ad4c5bf241b1def154958535bef6c2f6b733eb",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://safebooru.org/index.php?page=post&s=list&tags=all",
|
||||||
|
"#category": ("gelbooru_v02", "safebooru", "tag"),
|
||||||
|
"#class" : gelbooru_v02.GelbooruV02TagExtractor,
|
||||||
|
"#range" : "1-3",
|
||||||
|
"#count" : 3,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://safebooru.org/index.php?page=post&s=list&tags=",
|
||||||
|
"#category": ("gelbooru_v02", "safebooru", "tag"),
|
||||||
|
"#class" : gelbooru_v02.GelbooruV02TagExtractor,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://safebooru.org/index.php?page=pool&s=show&id=11",
|
"#url" : "https://safebooru.org/index.php?page=pool&s=show&id=11",
|
||||||
"#category": ("gelbooru_v02", "safebooru", "pool"),
|
"#category": ("gelbooru_v02", "safebooru", "pool"),
|
||||||
|
|||||||
Reference in New Issue
Block a user