1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[gelbooru] support 'all' and empty tag (#5076)

This commit is contained in:
Mike Fährmann 2024-01-18 21:49:33 +01:00
parent a416d4c3d5
commit 93b4120e77
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 32 additions and 2 deletions

View File

@ -118,7 +118,7 @@ class GelbooruBase():
class GelbooruTagExtractor(GelbooruBase,
gelbooru_v02.GelbooruV02TagExtractor):
"""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"

View File

@ -190,7 +190,7 @@ class GelbooruV02TagExtractor(GelbooruV02Extractor):
subcategory = "tag"
directory_fmt = ("{category}", "{search_tags}")
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"
def __init__(self, match):
@ -202,6 +202,8 @@ class GelbooruV02TagExtractor(GelbooruV02Extractor):
return {"search_tags": self.tags}
def posts(self):
if self.tags == "all":
self.tags = ""
return self._pagination({"tags": self.tags})

View File

@ -15,6 +15,20 @@ __tests__ = (
"#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",
"#category": ("booru", "gelbooru", "tag"),

View File

@ -16,6 +16,20 @@ __tests__ = (
"#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",
"#category": ("gelbooru_v02", "safebooru", "pool"),