Intermediate 4-5 hours · 2 APIs

Build an Anime Recommendation Engine

Get personalized anime recommendations based on your watch history and ratings. Discover new shows that match your taste across multiple anime databases.

APIs Used

Data Flow

USER User authenticates with anime account API Fetch user watch history and ratings via Kitsu PROCESS Extract top genres and themes from history API Search for highly-rated anime in those genres via AniAPI PROCESS Filter out already-watched and rank results OUTPUT Display personalized recommendations
User Action
API Call
Transform
Output

How It Works

1

User authenticates and their watch history is fetched from Kitsu

2

Extract top-rated genres and themes from the user's watched anime

3

Search AniAPI for highly-rated anime in those genres that the user hasn't seen

4

Score and rank recommendations based on genre overlap and rating

5

Display personalized recommendations with details and watch links

Code Outline

Pseudocode / JavaScript
// 1. Fetch user's anime library from Kitsu
const libraryRes = await fetch(
  'https://kitsu.io/api/edge/users/YOUR_USER_ID/library-entries?filter[status]=completed&include=anime&page[limit]=20',
  { headers: { 'Authorization': 'Bearer YOUR_OAUTH_TOKEN', 'Accept': 'application/vnd.api+json' } }
);
const library = await libraryRes.json();
const watchedAnime = library.included.map(a => ({
  id: a.id,
  title: a.attributes.canonicalTitle,
  genres: a.relationships?.genres?.data || []
}));

// 2. Extract favorite genres
const genreCounts = {};
watchedAnime.forEach(a => {
  a.genres.forEach(g => { genreCounts[g.id] = (genreCounts[g.id] || 0) + 1; });
});
const topGenres = Object.entries(genreCounts).sort((a, b) => b[1] - a[1]).slice(0, 3);

// 3. Search AniAPI for recommendations
const aniRes = await fetch(
  `https://api.aniapi.com/v1/anime?genres=${topGenres.map(g => g[0]).join(',')}&sort_fields=score&sort_directions=-1&per_page=10`,
  { headers: { 'Authorization': 'Bearer YOUR_ANIAPI_TOKEN' } }
);
const { data: { documents: recommendations } } = await aniRes.json();

// 4. Filter out already-watched anime
const watchedIds = new Set(watchedAnime.map(a => a.id));
const newRecs = recommendations.filter(r => !watchedIds.has(String(r.id)));

// 5. Display recommendations
console.log('Anime Recommendations For You:');
newRecs.slice(0, 5).forEach(r => {
  console.log(`${r.titles.en || r.titles.rj} - Score: ${r.score}/100`);
  console.log(`  Genres: ${r.genres.join(', ')}`);
});

Note: These recipes are AI-generated suggestions based on API capabilities. Actual implementation may vary. Always refer to official API documentation for the latest specifications.