#gelbooru #download #service #pictures #boosty

picdl-rs

A Rust library to download pictures from some services

4 releases

new 0.2.1 Dec 14, 2024
0.2.0 Dec 14, 2024
0.1.1 Dec 14, 2024
0.1.0 Dec 14, 2024

#335 in HTTP client

Download history 364/week @ 2024-12-09

364 downloads per month

MIT license

21KB
350 lines

picdl-rs

A simple Rust library to download media from various services, such as Gelbooru.

Installation

cargo add picdl_rs

Examples

Gelbooru

Fetch one post by tags

#[tokio::main]
async fn main() {
    let client = picdl_rs::gelbooru::Gelbooru::<picdl_rs::http::reqwest::ReqwestClient>::new();
    let post = client.fetch("omori rating:general", 1, 1, 0).await.unwrap().post[0].clone(); // "omori rating:general" is the tags to get posts by. Meta-tags are supported. Second argument is the count of posts to get (limit), third is page number and the last is change id, you can keep it 0. 
    println!("Tags: {}", post.tags);
    println!("File URL: {}", post.file_url);
}

Boosty

Fetch one post from blog

#[tokio::main]
async fn main() {
    let client = picdl_rs::boosty::Boosty::<picdl_rs::http::reqwest::ReqwestClient>::new();
    let post = client.fetch("boosty", 1).await.unwrap(); // Here, "boosty" is the name of a blog to get posts from, and 1 is count of posts to get (limit)
    println!("Post title: {}", post.data[0].title);
}

Dependencies

~9–21MB
~296K SLoC