11 releases

0.2.1 May 25, 2024
0.2.0 Jan 19, 2024
0.1.9 Jan 19, 2024

#5 in #client-builder

Download history 6/week @ 2024-07-27 5/week @ 2024-09-21 2/week @ 2024-09-28

785 downloads per month

MIT/Apache

34KB
888 lines

ci-badge crates.io version

booru-rs

An async Booru client for Rust

Overview

The client currently supports:

  • Gelbooru
  • Safebooru
  • Danbooru
  • Konachan
  • R34
  • 3DBooru
  • More... ?

Example

Remember to bring the Client trait into scope with use booru_rs::client::Client;

let posts = GelbooruClient::builder()
    .tag("kafuu_chino")
    .tag("2girls")
    .rating(GelbooruRating::General)
    .sort(GelbooruSort::Score)
    .limit(5)
    .random(true)
    .blacklist_tag(GelbooruRating::Explicit)
    .build()
    .get()
    .await
    .expect("There was an error retrieving posts from the API");

lib.rs:

Usage

use rusty_booru::{danbooru::{client::DanbooruClient, DanbooruRating}};
use rusty_booru::shared::{client::{WithClientBuilder, DispatcherTrait}, Sort};

#[tokio::main]
async fn main() {
    let posts = DanbooruClient::builder()
        .default_url("https://testbooru.donmai.us")
        .query(|q| {
            q.rating(DanbooruRating::General)
                .sort(Sort::Score)
                .limit(10)
        })
        .get()
        .await
        .expect("There was an error. (•-•)");

    match posts.first() {
        Some(post) => println!("{:?}", post),
        None => panic!("Well... \"No posts found?\""),
    }
}

Dependencies

~8–20MB
~279K SLoC