diff --git a/gallery_dl/extractor/gelbooru.py b/gallery_dl/extractor/gelbooru.py index e37b2e92..83f13922 100644 --- a/gallery_dl/extractor/gelbooru.py +++ b/gallery_dl/extractor/gelbooru.py @@ -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" diff --git a/gallery_dl/extractor/gelbooru_v02.py b/gallery_dl/extractor/gelbooru_v02.py index f8ab71c9..c7866bc4 100644 --- a/gallery_dl/extractor/gelbooru_v02.py +++ b/gallery_dl/extractor/gelbooru_v02.py @@ -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}) diff --git a/test/results/gelbooru.py b/test/results/gelbooru.py index 8d9ead27..b2f99ed1 100644 --- a/test/results/gelbooru.py +++ b/test/results/gelbooru.py @@ -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"), diff --git a/test/results/safebooru.py b/test/results/safebooru.py index 0c183204..f82f9681 100644 --- a/test/results/safebooru.py +++ b/test/results/safebooru.py @@ -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"),