#anime #client #anidb-api #anidb

anidb-api

Rust library that provides wrapper for AniDB API

2 releases

Uses new Rust 2024

new 0.1.1 Apr 28, 2025
0.1.0 Apr 28, 2025

#420 in Web programming

MIT/Apache

48KB
1K SLoC

anidb-api

crates.io docs.rs

An asynchronous Rust client for interacting with the AniDB HTTP API. Features a built-in rate limiter for safe and respectful API usage.

Features

  • Asynchronous operation.
  • Built-in rate limiter to comply with AniDB API limits.
  • Simple interface for fetching data.
  • Basic support for tracing logging.

Status

  • Implemented:
    • get_anime: Fetch detailed information about an anime by its ID.
  • In Progress:
    • Fetching random recommendations.
    • Fetching random similar anime.
    • Fetching the hot anime list.
    • Fetching main page data.

Installation

Add the dependency to your Cargo.toml:

[dependencies]
anidb-api = "0.1.0"

Usage Example

use anidb_api::http::{AniDbHttpClient, models::anime::Anime};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize the client
    let anidb = AniDbHttpClient::new()?;
    // All IDs are Strings
    let anime_id = "17110";
    // Get xml data from AniDB and deserialize it into `Anime` struct
    let anime: Anime = anidb.get_anime(anime_id).await?;
    // Serialize this struct into json and write it into file, for testing purposes
    let file = std::fs::File::create("anime.json")?;
    serde_json::to_writer_pretty(file, &anime)?;
    println!("`Anime` struct serialized successfully!");
    Ok(())
}

License

This project is licensed under the [MIT] or Apache-2.0 License.

Dependencies

~8–20MB
~270K SLoC