Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cijiugechu/booru
An async Booru client for Rust
https://github.com/cijiugechu/booru
api booru client danbooru gelbooru rule34 rust safebooru
Last synced: 8 days ago
JSON representation
An async Booru client for Rust
- Host: GitHub
- URL: https://github.com/cijiugechu/booru
- Owner: cijiugechu
- License: mit
- Created: 2023-09-29T16:46:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-31T02:54:30.000Z (2 months ago)
- Last Synced: 2024-10-01T13:22:22.814Z (about 1 month ago)
- Topics: api, booru, client, danbooru, gelbooru, rule34, rust, safebooru
- Language: Rust
- Homepage:
- Size: 118 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Cargo](https://img.shields.io/crates/v/booru.svg)](https://crates.io/crates/booru) [![Documentation](https://docs.rs/booru/badge.svg)](https://docs.rs/booru)
# `booru`
An async Booru client for Rust.> Note: This project has been forked from [booru-rs](https://github.com/ajiiisai/booru-rs) since September of 2023, but a lot has changed.
## Overview
The client currently supports:
- [x] Gelbooru
- [x] Safebooru
- [x] Danbooru
- [x] Rule 34## Example
Remember to bring the `Client` trait into scope with `use booru::client::Client;`.
```rust
use booru::{
client::{gelbooru::GelbooruClient, generic::*, Client},
model::gelbooru::GelbooruRating,
};#[tokio::main]
async fn main() {
let posts = GelbooruClient::builder()
.tag("kafuu_chino")
.tag("2girls")
.rating(GelbooruRating::General)
.sort(Sort::Score)
.limit(5)
.random()
.blacklist_tag(GelbooruRating::Explicit)
.build()
.get()
.await
.expect("There was an error retrieving posts from the API");
}
```### Customizing http client
If you want to customize http client, you can use `builder_with_http_client`:
```rust
use booru::{
client::{gelbooru::GelbooruClient, generic::*, Client},
model::gelbooru::GelbooruRating,
};
use reqwest;
use std::time::Duration;#[tokio::main]
async fn main() {
let http_client_builder = reqwest::ClientBuilder::new()
.timeout(Duration::from_secs(10));let posts = GelbooruClient::builder_with_http_client(http_client_builder)
.tag("kafuu_chino")
.limit(5)
.build()
.get()
.await
.expect("There was an error retrieving posts from the API");
}
```