Skip to content

Commit

Permalink
add support for aibooru (using danbooru extractor) (#3075)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatfuckingbird authored and mikf committed Oct 29, 2022
1 parent d61c05f commit 9332501
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,12 @@ Consider all sites to be NSFW unless otherwise known.
<td>Pools, Popular Images, Posts, Tag Searches</td>
<td>Supported</td>
</tr>
<tr>
<td>Aibooru</td>
<td>https://aibooru.online/</td>
<td>Favorites, Pools, Popular Images, Posts, Tag Searches</td>
<td></td>
</tr>

<tr>
<td colspan="4"><strong>Gelbooru Beta 0.1.11</strong></td>
Expand Down
17 changes: 17 additions & 0 deletions gallery_dl/extractor/danbooru.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
)
Expand Down Expand Up @@ -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"),
)
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion test/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9332501

Please sign in to comment.