A typed Rust client and a set of data tools for Danbooru-compatible APIs.
The workspace requires Rust 1.88 or newer and contains:
booru: API client, query types, response models, and tag utilities.crawl: resumable JSONL post crawler.gather: concurrent image and caption downloader.wiki: wiki-page fetcher and category enrichment tools.hf: the small Hugging Face/Parquet boundary used bywiki.
use booru::{
board::danbooru::{self, Endpoint, Query},
client::{Auth, Client},
};
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::danbooru(Auth::new("username", "api-key"))?;
let mut search = danbooru::SearchTagsBuilder::new();
search.add_tag("cat_ears");
search.ratings([danbooru::Rating::General]);
search.scores([danbooru::search::Score::Min(50)]);
let mut query = Query::posts(search.build());
query.limit(20);
let posts: danbooru::response::Posts = client.get(&Endpoint::Posts, &query).await?;
# Ok(())
# }API and asset traffic use separate HTTP clients. Client::get_asset never sends the
Danbooru authorization header, including when a post points at another origin.
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-targets --all-features --lockedThe three live API tests are ignored by default because they require credentials and
network access. The DANBOORU_USERNAME and DANBOORU_API_KEY environment variables
are consumed by the command-line tools.