A professional, modern C++ library for the Jikan API - the unofficial MyAnimeList REST API.
- 🚀 Complete API Coverage - All Jikan v4 endpoints supported
- ⚡ Rate Limiting Built-in - Automatic 3 req/s limit handling
- 🔒 Thread-Safe - Safe for concurrent usage
- 📦 Easy Integration - Header-organized design
- ✅ Well Tested - Comprehensive unit tests
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- libcurl (for HTTP requests)
- nlohmann/json (included as single header)
# Clone the repository
git clone https://github.com/mhmmdyusran/jikan-cpp.git
cd jikan-cpp
# Build the library
make
# Install (Linux/macOS)
sudo make install#include <jikan/jikan.hpp>jikan::Client client; // Rate limiting is automaticauto anime = client.anime().getById(1); // Cowboy Bebop
std::cout << "Title: " << anime.title << std::endl;
std::cout << "Score: " << *anime.score << std::endl;
std::cout << "Episodes: " << *anime.episodes << std::endl;
std::cout << "Status: " << *anime.status << std::endl;
std::cout << "Synopsis: " << *anime.synopsis << std::endl;auto anime = client.anime().getFullById(1);
// Includes relations, themes, streaming links
for (const auto& rel : anime.relations) {
std::cout << rel.relation << std::endl;
}auto characters = client.anime().getCharacters(1);
for (const auto& c : characters) {
std::cout << c.character.name << " - " << c.role << std::endl;
for (const auto& va : c.voice_actors) {
std::cout << " VA: " << va.person.name << " (" << va.language << ")" << std::endl;
}
}auto response = client.anime().getEpisodes(1, 1); // page 1
for (const auto& ep : response.data) {
std::cout << "Episode " << ep.mal_id << ": " << ep.title << std::endl;
}auto staff = client.anime().getStaff(1);
for (const auto& s : staff) {
std::cout << s.person.name << ": ";
for (const auto& pos : s.positions) {
std::cout << pos << " ";
}
std::cout << std::endl;
}auto news = client.anime().getNews(1);
auto videos = client.anime().getVideos(1);
auto stats = client.anime().getStatistics(1);
std::cout << "Watching: " << stats.watching << std::endl;
std::cout << "Completed: " << stats.completed << std::endl;auto reviews = client.anime().getReviews(1);
for (const auto& r : reviews.data) {
std::cout << r.user.username << " scored: " << r.score << std::endl;
}jikan::AnimeSearchParams params;
params.q = "Naruto";
params.type = "tv";
params.status = "complete";
params.min_score = 7.0;
params.order_by = "score";
params.sort = "desc";
params.sfw = true;
auto results = client.anime().search(params);
for (const auto& a : results.data) {
std::cout << a.title << " - Score: " << *a.score << std::endl;
}
// Pagination info
std::cout << "Page: " << results.pagination.current_page << std::endl;
std::cout << "Has next: " << results.pagination.has_next_page << std::endl;auto manga = client.manga().getById(1); // Monster
std::cout << "Title: " << manga.title << std::endl;
std::cout << "Chapters: " << *manga.chapters << std::endl;
std::cout << "Volumes: " << *manga.volumes << std::endl;jikan::MangaSearchParams params;
params.q = "One Piece";
params.type = "manga";
params.status = "publishing";
auto results = client.manga().search(params);auto character = client.characters().getById(1); // Spike Spiegel
std::cout << "Name: " << character.name << std::endl;
std::cout << "Favorites: " << character.favorites << std::endl;auto anime = client.characters().getAnime(1);
auto manga = client.characters().getManga(1);auto voices = client.characters().getVoices(1);
for (const auto& v : voices) {
std::cout << v.person.name << " (" << v.language << ")" << std::endl;
}jikan::CharacterSearchParams params;
params.q = "Naruto";
auto results = client.characters().search(params);auto person = client.people().getById(1);
std::cout << "Name: " << person.name << std::endl;
std::cout << "Birthday: " << *person.birthday << std::endl;auto anime = client.people().getAnime(1);
auto voices = client.people().getVoices(1);auto user = client.users().getByUsername("Nekomata1037");
std::cout << "Username: " << user.username << std::endl;
std::cout << "Joined: " << *user.joined << std::endl;auto stats = client.users().getStatistics("Nekomata1037");
std::cout << "Anime watched: " << stats.anime.completed << std::endl;
std::cout << "Mean score: " << stats.anime.mean_score << std::endl;
std::cout << "Days watched: " << stats.anime.days_watched << std::endl;auto favorites = client.users().getFavorites("Nekomata1037");
for (const auto& a : favorites.anime) {
std::cout << "Favorite anime: " << a.title << std::endl;
}jikan::UserListParams params;
params.status = "completed";
auto animeList = client.users().getAnimeList("Nekomata1037", params);
for (const auto& entry : animeList.data) {
std::cout << entry.title << " - Score: " << entry.score << std::endl;
}
auto mangaList = client.users().getMangaList("Nekomata1037", params);auto history = client.users().getHistory("Nekomata1037");
auto friends = client.users().getFriends("Nekomata1037");auto current = client.seasons().getNow();
for (const auto& a : current.data) {
std::cout << a.title << std::endl;
}auto winter2024 = client.seasons().getSeason(2024, "winter");
auto summer2023 = client.seasons().getSeason(2023, "summer");auto upcoming = client.seasons().getUpcoming();auto archive = client.seasons().getArchive();auto topAnime = client.top().getTopAnime();
auto topManga = client.top().getTopManga();
for (int i = 0; i < 10 && i < topAnime.data.size(); i++) {
std::cout << "#" << (i+1) << " " << topAnime.data[i].title << std::endl;
}jikan::TopAnimeParams params;
params.type = "tv";
params.filter = "airing";
auto airing = client.top().getTopAnime(params);
params.filter = "bypopularity";
auto popular = client.top().getTopAnime(params);auto topCharacters = client.top().getTopCharacters();
auto topPeople = client.top().getTopPeople();auto schedule = client.schedule().getSchedule(); // All daysauto monday = client.schedule().getSchedule("monday");
auto saturday = client.schedule().getSchedule("saturday");auto producer = client.producers().getById(1); // Studio Pierrot
std::cout << "Studio: " << producer.titles[0].title << std::endl;jikan::ProducerSearchParams params;
params.q = "MAPPA";
auto results = client.producers().search(params);auto magazine = client.magazines().getById(1);auto club = client.clubs().getById(1);
std::cout << "Club: " << club.name << std::endl;
std::cout << "Members: " << club.members_count << std::endl;auto members = client.clubs().getMembers(1);
auto staff = client.clubs().getStaff(1);auto animeGenres = client.genres().getAnimeGenres();
auto mangaGenres = client.genres().getMangaGenres();
for (const auto& g : animeGenres) {
std::cout << g.name << " (" << g.count << " anime)" << std::endl;
}auto randomAnime = client.random().getAnime();
auto randomManga = client.random().getManga();
auto randomCharacter = client.random().getCharacter();
auto randomPerson = client.random().getPerson();auto animeReviews = client.reviews().getAnimeReviews();
auto mangaReviews = client.reviews().getMangaReviews();auto animeRecs = client.recommendations().getAnimeRecommendations();
auto mangaRecs = client.recommendations().getMangaRecommendations();auto recentEps = client.watch().getRecentEpisodes();
auto popularEps = client.watch().getPopularEpisodes();
auto promos = client.watch().getRecentPromos();#include <jikan/exceptions.hpp>
try {
auto anime = client.anime().getById(99999999);
} catch (const jikan::NotFoundException& e) {
std::cerr << "Not found: " << e.what() << std::endl;
} catch (const jikan::RateLimitException& e) {
std::cerr << "Rate limited: " << e.what() << std::endl;
} catch (const jikan::ApiException& e) {
std::cerr << "API error (" << e.statusCode() << "): " << e.what() << std::endl;
} catch (const jikan::NetworkException& e) {
std::cerr << "Network error: " << e.what() << std::endl;
} catch (const jikan::ParseException& e) {
std::cerr << "Parse error: " << e.what() << std::endl;
}make # Build static library (default)
make static # Build static library (libjikan.a)
make shared # Build shared library (libjikan.so)
make tests # Build and run unit tests
make examples # Build example programs
make install # Install to /usr/local
make uninstall # Remove installation
make clean # Remove build directory
make DEBUG=1 # Debug build# After installation
g++ -std=c++17 your_program.cpp -ljikan -lcurl -o your_program
# Without installation (using local build)
g++ -std=c++17 -I./include -I./third_party your_program.cpp \
-L./build/lib -ljikan -lcurl -o your_programSee the examples directory:
basic_usage.cpp- Basic anime/manga lookupsearch_example.cpp- Advanced search with filtersuser_list.cpp- Fetching user anime/manga lists
MIT License - see LICENSE for details.
- Jikan API - The awesome unofficial MyAnimeList API
- MyAnimeList - The data source
- nlohmann/json - JSON library