/mal-api

.NET API for accessing the myanimelist.net API

Primary LanguageHTMLApache License 2.0Apache-2.0

myanimelist.net's API was taken down in 2018. There is now a new API, but I no longer watch anime and am not interested in investing the time to update this library.


MalApi is a .NET library written in C# for accessing the myanimelist.net API or using scraping methods where no official API is available. Using it is easy:

using (MyAnimeListApi api = new MyAnimeListApi())
{
	api.UserAgent = "my_app"; // MAL now requires applications to be whitelisted. Whitelisted applications identify themselves by their user agent.
	MalUserLookupResults userLookup = api.GetAnimeListForUser("LordHighCaptain");
	foreach (MyAnimeListEntry listEntry in userLookup.AnimeList)
	{
		Console.WriteLine("Rating for {0}: {1}", listEntry.AnimeInfo.Title, listEntry.Score);
	}
}

Binaries are available as a NuGet package called MalApi. The package supports .NET 4.5.2 and netstandard 1.3.

MalApi currently contains these MAL functions:

Also included are some useful implementations of IMyAnimeListApi that wrap another IMyAnimeListApi.

  • CachingMyAnimeListApi caches user lookups for a configurable amount of time.
  • RateLimitingMyAnimeListApi limits MAL requests to once every N milliseconds so you can throttle your requests if you are making a large number of them.
  • RetryOnFailureMyAnimeListApi waits a short period before retrying a request if a request fails. After a certain number of failures, it will give up.

MalApi can be configured to log using any logging library compatible with Common.Logging. See App.config in the MalApi.Example project. MalApi will use the logger name "MAL API". Consult the Common.Logging and NLog documentation for more information about logging.

MalApi is licensed under the Apache License 2.0.