11 releases

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

#2251 in Web programming

Download history 217/week @ 2024-05-25 12/week @ 2024-06-01 6/week @ 2024-06-08 2/week @ 2024-06-15 51/week @ 2024-07-06 4/week @ 2024-07-13 6/week @ 2024-07-27

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

~7–19MB
~279K SLoC