From 93325015ee60422ffaea5fdb014b55e025ced4dc Mon Sep 17 00:00:00 2001
From: thatfuckingbird <67429906+thatfuckingbird@users.noreply.github.com>
Date: Wed, 19 Oct 2022 11:53:59 +0200
Subject: [PATCH] add support for aibooru (using danbooru extractor) (#3075)
---
docs/supportedsites.md | 6 ++++++
gallery_dl/extractor/danbooru.py | 17 +++++++++++++++++
test/test_results.py | 2 +-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/docs/supportedsites.md b/docs/supportedsites.md
index ca0c434a07b..c886f979d6f 100644
--- a/docs/supportedsites.md
+++ b/docs/supportedsites.md
@@ -977,6 +977,12 @@ Consider all sites to be NSFW unless otherwise known.
Pools, Popular Images, Posts, Tag Searches |
Supported |
+
+ Aibooru |
+ https://aibooru.online/ |
+ Favorites, Pools, Popular Images, Posts, Tag Searches |
+ |
+
Gelbooru Beta 0.1.11 |
diff --git a/gallery_dl/extractor/danbooru.py b/gallery_dl/extractor/danbooru.py
index c455ce19282..6068da0e8ce 100644
--- a/gallery_dl/extractor/danbooru.py
+++ b/gallery_dl/extractor/danbooru.py
@@ -102,6 +102,9 @@ def items(self):
resp = self.request(template.format(self.root, post["id"]))
post.update(resp.json())
+ if url[0] == "/":
+ url = self.root + url
+
post.update(data)
yield Message.Directory, post
yield Message.Url, url, post
@@ -170,6 +173,10 @@ def _ugoira_frames(self, post):
"pattern": r"booru\.allthefallen\.moe",
"page-limit": 5000,
},
+ "aibooru": {
+ "root": "https://aibooru.online",
+ "pattern": r"aibooru\.online",
+ }
}
BASE_PATTERN = DanbooruExtractor.update(INSTANCES)
@@ -202,6 +209,11 @@ class DanbooruTagExtractor(DanbooruExtractor):
("https://booru.allthefallen.moe/posts?tags=yume_shokunin", {
"count": 12,
}),
+ ("https://aibooru.online/posts?tags=center_frills&z=1", {
+ "pattern": r"https://aibooru\.online/data/original"
+ r"/[0-9a-f]{2}/[0-9a-f]{2}/[0-9a-f]{32}\.\w+",
+ "count": ">= 3",
+ }),
("https://hijiribe.donmai.us/posts?tags=bonocho"),
("https://sonohara.donmai.us/posts?tags=bonocho"),
("https://safebooru.donmai.us/posts?tags=bonocho"),
@@ -238,6 +250,7 @@ class DanbooruPoolExtractor(DanbooruExtractor):
"url": "902549ffcdb00fe033c3f63e12bc3cb95c5fd8d5",
"count": 6,
}),
+ ("https://aibooru.online/pools/1"),
("https://danbooru.donmai.us/pool/show/7659"),
("https://e621.net/pool/show/73"),
)
@@ -300,6 +313,9 @@ class DanbooruPostExtractor(DanbooruExtractor):
("https://booru.allthefallen.moe/posts/22", {
"content": "21dda68e1d7e0a554078e62923f537d8e895cac8",
}),
+ ("https://aibooru.online/posts/1", {
+ "content": "54d548743cd67799a62c77cbae97cfa0fec1b7e9",
+ }),
("https://danbooru.donmai.us/post/show/294929"),
("https://e621.net/post/show/535"),
)
@@ -334,6 +350,7 @@ class DanbooruPopularExtractor(DanbooruExtractor):
"count": ">= 70",
}),
("https://booru.allthefallen.moe/explore/posts/popular"),
+ ("https://aibooru.online/explore/posts/popular"),
)
def __init__(self, match):
diff --git a/test/test_results.py b/test/test_results.py
index e5949331b97..a42de090a35 100644
--- a/test/test_results.py
+++ b/test/test_results.py
@@ -324,7 +324,7 @@ def setup_test_config():
for category in ("danbooru", "instagram", "twitter", "subscribestar",
"e621", "atfbooru", "inkbunny", "tapas", "pillowfort",
- "mangadex"):
+ "mangadex", "aibooru"):
config.set(("extractor", category), "username", None)
config.set(("extractor", "mastodon.social"), "access-token",