#download #image #gelbooru #boosty #service #post #error

imgdl-rs

A Rust library for downloading images from services like Boosty and Gelbooru

4 releases (stable)

1.2.0 Jul 12, 2024
1.1.0 Jul 12, 2024
1.0.0 Jul 11, 2024
0.0.1 Jul 10, 2024

#519 in Authentication

Download history 266/week @ 2024-07-08 28/week @ 2024-07-15 36/week @ 2024-07-22 21/week @ 2024-07-29 13/week @ 2024-08-05 13/week @ 2024-08-12 13/week @ 2024-08-19 16/week @ 2024-08-26 7/week @ 2024-09-02 10/week @ 2024-09-09 44/week @ 2024-09-16

80 downloads per month
Used in boostydownload

MIT license

20KB
271 lines

imgdl-rs

FORMER boosty-rs
A Rust library for downloading images from such services like Boosty and Gelbooru-powered sites
Rust

Installation

$ cargo add imgdl-rs

Examples

Boosty

Fetch all posts from blog

use std::error::Error;
use boosty_rs::boosty::request;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let response = request::Client::fetch_posts("boosty".to_string(), None).await?;
    println!("{:?}", response); 
    Ok(())
}

Fetch one post from blog

use std::error::Error;
use boosty_rs::boosty::request;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let response = request::Client::fetch_post("boosty".to_string(), "a4dc61c8-4ff9-495b-946b-3982efef68fe".to_string(), None).await?;
    println!("{:?}", response); 
    Ok(())
}

Fetch all posts from blog with authorization

use std::error::Error;
use boosty_rs::boosty::request;
use boosty_rs::boosty::auth::Auth;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let response = request::Client::fetch_posts("boosty".to_string(), Auth::new("access_token".to_string())).await?;
    println!("{:?}", response); 
    Ok(())
}

Gelbooru

Fetch posts from tags

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = imgdl_rs::gelbooru::request::Client::new(None);
    let posts = client.fetch_posts(
        "rating:general blue_sky", 3
    ).await?; // Fetch all posts with tags `rating:general blue_sky` from page 3
    println!("{:?}", posts); 
    Ok(())
}

Dependencies

~8–20MB
~292K SLoC