A comprehensive Rust library for the Jikan API - an unofficial REST API for MyAnimeList. This library provides type-safe access to all Jikan API v4 endpoints with built-in rate limiting and error handling.
- β Rate Limiting - Built-in rate limiting (3 requests per second, burst of 5)
- β Complete API Coverage - All Jikan API v4 endpoints supported
- β Async/Await Support - Full async/await compatibility with tokio
- β Type Safety - Strongly typed responses with serde
- β Comprehensive Error Handling - Detailed error types for better debugging
- β JSON Serialization - Automatic JSON parsing with serde
- β URL Encoding - Proper URL encoding for search queries
- β Random Endpoints - Support for random anime, manga, characters
- β Watch Endpoints - Recent and popular episodes/promos
- β Club Endpoints - MyAnimeList club information
Add this to your Cargo.toml:
[dependencies]
jikan-rs = "0.1.0"
tokio = { version = "1.0", features = ["full"] }use jikan_rs::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let client = JikanClient::new();
// Get anime information
let anime = client.get_anime(1).await?;
println!("Anime: {}", anime.data.title);
// Search for anime
let search_results = client.search_anime("Naruto", Some(1), Some(10)).await?;
for anime in search_results.data {
println!("- {}", anime.title);
}
// Get top anime
let top_anime = client.get_top_anime(Some(1), Some(10), None, None).await?;
for anime in top_anime.data {
println!("- {} (Score: {:?})", anime.title, anime.score);
}
// Get random anime
let random_anime = client.get_random_anime().await?;
println!("Random anime: {}", random_anime.data.title);
Ok(())
}get_anime(id)- Get anime by IDget_anime_full(id)- Get full anime detailsget_anime_characters(id)- Get anime charactersget_anime_staff(id)- Get anime staffget_anime_episodes(id, page)- Get anime episodesget_anime_episode(id, episode)- Get specific episodeget_anime_news(id, page)- Get anime newsget_anime_forum(id, filter)- Get anime forum topicsget_anime_videos(id)- Get anime videosget_anime_videos_episodes(id, page)- Get episode videosget_anime_pictures(id)- Get anime picturesget_anime_statistics(id)- Get anime statisticsget_anime_more_info(id)- Get additional informationget_anime_recommendations(id)- Get recommendationsget_anime_user_updates(id, page)- Get user updatesget_anime_reviews(id, page, preliminary, spoiler)- Get anime reviewsget_anime_relations(id)- Get related animeget_anime_themes(id)- Get opening/ending themesget_anime_external(id)- Get external linksget_anime_streaming(id)- Get streaming platforms
get_manga(id)- Get manga by IDget_manga_full(id)- Get full manga detailsget_manga_characters(id)- Get manga charactersget_manga_news(id, page)- Get manga newsget_manga_forum(id, filter)- Get manga forum topicsget_manga_pictures(id)- Get manga picturesget_manga_statistics(id)- Get manga statisticsget_manga_more_info(id)- Get additional informationget_manga_recommendations(id)- Get recommendationsget_manga_user_updates(id, page)- Get user updatesget_manga_reviews(id, page, preliminary, spoiler)- Get manga reviewsget_manga_relations(id)- Get related mangaget_manga_external(id)- Get external links
get_character(id)- Get character informationget_character_full(id)- Get full character detailsget_character_anime(id)- Get character's anime appearancesget_character_manga(id)- Get character's manga appearancesget_character_voice_actors(id)- Get voice actorsget_character_pictures(id)- Get character pictures
get_person(id)- Get person informationget_person_full(id)- Get full person detailsget_person_anime(id)- Get person's anime workget_person_manga(id)- Get person's manga workget_person_voice_acting(id)- Get voice acting rolesget_person_pictures(id)- Get person pictures
search_anime(query, page, limit)- Search animesearch_anime_advanced(...)- Advanced anime searchsearch_manga(query, page, limit)- Search mangasearch_manga_advanced(...)- Advanced manga searchsearch_characters(query, page, limit)- Search characterssearch_people(query, page, limit)- Search peoplesearch_users(query, page, limit)- Search users
get_top_anime(page, limit, type, filter)- Top animeget_top_manga(page, limit, type, filter)- Top mangaget_top_characters(page, limit)- Top charactersget_top_people(page, limit)- Top peopleget_recent_anime_reviews(page)- Recent anime reviewsget_recent_manga_reviews(page)- Recent manga reviews
get_season_now(...)- Currently airing animeget_season(year, season, ...)- Anime from specific seasonget_season_upcoming(...)- Upcoming animeget_seasons_archive()- Season archive
get_random_anime()- Random animeget_random_manga()- Random mangaget_random_character()- Random characterget_random_person()- Random personget_random_user()- Random user
get_watch_recent_episodes(page)- Recent episodesget_watch_popular_episodes(page)- Popular episodesget_watch_recent_promos(page)- Recent promotional videosget_watch_popular_promos(page)- Popular promotional videos
get_club(id)- Club informationget_club_members(id, page)- Club membersget_club_staff(id)- Club staffget_club_relations(id)- Club relations
get_schedules(...)- Anime broadcast scheduleget_anime_genres(filter)- Anime genresget_manga_genres(filter)- Manga genresget_user_profile(username)- User profileget_producers(page, limit)- Producersget_producer(id)- Producer informationget_magazines(page, limit)- Magazinesget_magazine(id)- Magazine information
The library automatically handles rate limiting (3 requests per second by default). You can customize this:
// Custom rate limit: 2 requests per second, burst of 3
let client = JikanClient::with_rate_limit(2, 3);To disable rate limiting completely:
[dependencies]
jikan-rs = { version = "0.1.0", default-features = false }match client.get_anime(999999).await {
Ok(response) => println!("Anime: {}", response.data.title),
Err(JikanError::NotFound) => println!("Anime not found"),
Err(JikanError::RateLimitExceeded) => println!("Rate limit exceeded"),
Err(JikanError::ApiError { status, message }) => {
println!("API Error {}: {}", status, message)
},
Err(e) => println!("Error: {:?}", e),
}Run the basic example:
cargo run --example basic_usageRun the comprehensive example:
cargo run --example comprehensive_usagecargo testContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Jikan API for providing the excellent MyAnimeList API
- MyAnimeList for being the ultimate anime and manga database
- The Rust community for amazing crates and tools
Made with β€οΈ by sw3do