Crate mal [] [src]

The purpose of this library is to provide high-level access to the MyAnimeList API. It allows you to add, update, delete, read, and search for anime / manga from a user's list, as well as verify user credentials.

All operations are centered around the MAL struct, as it stores the user credentials required to perform most operations on the API.

Please keep in mind that the API is rate limited to around ~5 requests per minute. If you send too many requests, the caller's IP will be banned for ~1-2 hours and all requests will return a 403 (Forbidden) status code.


Adding an anime to a user's list:

use mal::MAL;
use mal::list::Status;
use mal::list::anime::AnimeEntry;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Search for "Toradora" on MyAnimeList
let mut search_results = mal.anime_list().search_for("Toradora").unwrap();

// Use the first result's info
let toradora_info = search_results.swap_remove(0);

// Create a new anime list entry with Toradora's info
let mut entry = AnimeEntry::new(toradora_info);

// Set the entry's watched episodes to 5 and status to watching

// Add the entry to the user's anime list
mal.anime_list().add(&mut entry).unwrap();

Updating a manga on a user's list by its ID:

use mal::MAL;
use mal::list::Status;
use mal::list::manga::MangaValues;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Create new entry values
let mut values = MangaValues::new();

// Set the number of read chapters to 25, read volumes to 2, score to 10, and status to completed

// Update the entry with an id of 2 (Berserk) on the user's manga list with the specified values
mal.manga_list().update_id(2, &mut values).unwrap();

Retrieving an anime off of a user's list and updating it:

use mal::MAL;
use mal::list::Status;

// Create a new MAL instance
let mal = MAL::new("username", "password");

// Read the user's anime list
let list = mal.anime_list().read().unwrap();

// Find the first series on the user's list that's being watched
let mut entry = list.entries.into_iter().find(|e| {
    e.values.status() == Status::WatchingOrReading

// Set the entrie's watched episodes to its total episodes, its score to 10, and status to completed

// Update the entry on the user's anime list with the new values
mal.anime_list().update(&mut entry).unwrap();



This module provides generic functionality for adding, updating, deleting, and reading entries from a user's anime / manga list, as well as searching for an anime / manga series.



Used to interact with the MyAnimeList API with authorization being handled automatically.