picdl-rs

Crates.iopicdl-rs
lib.rspicdl-rs
version0.2.1
created_at2024-12-14 13:44:13.881599+00
updated_at2024-12-14 14:41:37.010337+00
descriptionA Rust library to download pictures from some services
homepage
repositoryhttps://github.com/korupi/picdl-rs
max_upload_size
id1483150
size22,460
corruptmemory (crptmem)

documentation

README

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);
}
Commit count: 9

cargo fmt