Skip to main content

Overview

AniDojo provides two functions for fetching seasonal anime data:
  • getSeasonalAnime() - Get anime from a specific season and year
  • getCurrentSeasonAnime() - Get anime from the current season
Both functions return paginated results from the MyAnimeList database.

getSeasonalAnime()

Retrieve anime that aired during a specific season and year.

Function Signature

getSeasonalAnime(
  year: number,
  season: 'winter' | 'spring' | 'summer' | 'fall',
  limit?: number
): Promise<JikanSearchResponse>

Parameters

year
number
required
The year to fetch anime from.
  • Format: Four-digit year (e.g., 2024, 2023)
  • Range: 1917 to current year + 1
  • Example: 2024, 2023, 2022
season
'winter' | 'spring' | 'summer' | 'fall'
required
The season to fetch anime from.
  • winter - January, February, March
  • spring - April, May, June
  • summer - July, August, September
  • fall - October, November, December
Season names must be lowercase
limit
number
Maximum number of results to return.
  • Range: 1-25
  • Default: All results (no limit)
  • Useful for previews or reduced bandwidth

Return Value

Returns a JikanSearchResponse with seasonal anime data.
data
JikanAnime[]
required
Array of anime that aired during the specified season.Results include:
  • All anime with season matching the parameter
  • Sorted by popularity/score
  • Complete metadata (see JikanAnime interface)
pagination
object
required
Pagination information (typically single page for seasonal queries)

Examples

import { getSeasonalAnime } from '@/lib/animeApi';

// Get Winter 2024 anime
const winter2024 = await getSeasonalAnime(2024, 'winter');

console.log(`${winter2024.data.length} anime aired in Winter 2024`);

winter2024.data.forEach(anime => {
  console.log(`- ${anime.title}`);
  console.log(`  Score: ${anime.score}/10`);
  console.log(`  Episodes: ${anime.episodes}`);
});

Advanced Usage

import { getSeasonalAnime, type JikanAnime } from '@/lib/animeApi';

async function compareSeasons(year: number) {
  const [winter, spring, summer, fall] = await Promise.all([
    getSeasonalAnime(year, 'winter'),
    getSeasonalAnime(year, 'spring'),
    getSeasonalAnime(year, 'summer'),
    getSeasonalAnime(year, 'fall')
  ]);
  
  return {
    winter: {
      count: winter.data.length,
      avgScore: average(winter.data.map(a => a.score))
    },
    spring: {
      count: spring.data.length,
      avgScore: average(spring.data.map(a => a.score))
    },
    summer: {
      count: summer.data.length,
      avgScore: average(summer.data.map(a => a.score))
    },
    fall: {
      count: fall.data.length,
      avgScore: average(fall.data.map(a => a.score))
    }
  };
}

function average(numbers: number[]) {
  return numbers.reduce((a, b) => a + b, 0) / numbers.length;
}

const stats = await compareSeasons(2023);
console.log('2023 Anime by Season:', stats);

getCurrentSeasonAnime()

Retrieve anime currently airing in the present season.

Function Signature

getCurrentSeasonAnime(limit?: number): Promise<JikanSearchResponse>

Parameters

limit
number
Maximum number of results to return.
  • Range: 1-25
  • Default: All results
  • Use smaller limits for homepage previews

Return Value

data
JikanAnime[]
required
Array of anime currently airing in the present season.Automatically determines:
  • Current year
  • Current season (winter/spring/summer/fall)
  • Returns anime airing now
pagination
object
required
Pagination metadata

Examples

import { getCurrentSeasonAnime } from '@/lib/animeApi';

const current = await getCurrentSeasonAnime();

console.log(`${current.data.length} anime airing this season`);

current.data.forEach(anime => {
  console.log(`${anime.title}`);
  console.log(`  Episodes: ${anime.episodes || 'Ongoing'}`);
  console.log(`  Airing: ${anime.airing ? 'Yes' : 'No'}`);
});

Advanced Usage

const current = await getCurrentSeasonAnime();

const airing = current.data.filter(a => a.airing);
const completed = current.data.filter(a => !a.airing);

console.log(`Currently airing: ${airing.length}`);
console.log(`Completed this season: ${completed.length}`);

// Show next episode times
airing.forEach(anime => {
  if (anime.broadcast) {
    console.log(`${anime.title} airs ${anime.broadcast.string}`);
  }
});

React Hook Usage

Use the useSeasonalAnime hook for React components:
import { useSeasonalAnime } from '@/hooks/useAnime';

function SeasonalAnime() {
  const { data, loading, error } = useSeasonalAnime(2024, 'winter');
  
  if (loading) return <div>Loading winter 2024 anime...</div>;
  if (error) return <div>Error: {error}</div>;
  
  return (
    <div>
      <h1>Winter 2024 Anime ({data.length})</h1>
      <div className="anime-grid">
        {data.map(anime => (
          <div key={anime.id} className="anime-card">
            <img src={anime.coverArt} alt={anime.title} />
            <h3>{anime.title}</h3>
            <span className="score">{anime.score}/10</span>
          </div>
        ))}
      </div>
    </div>
  );
}

Season Mappings

MyAnimeList uses the following season definitions:
January - March
const winter = await getSeasonalAnime(2024, 'winter');
// Returns anime that aired Jan-Mar 2024
Typically includes:
  • New year releases
  • Continuation of fall series

Performance & Caching

Caching Behavior

Seasonal queries are cached for 5 minutes:
// First call - fetches from API
const winter1 = await getSeasonalAnime(2024, 'winter');

// Within 5 minutes - returns cached
const winter2 = await getSeasonalAnime(2024, 'winter');

// Different season - new request
const spring = await getSeasonalAnime(2024, 'spring');

Rate Limiting

Automatic rate limiting applies:
  • Max 3 requests per second
  • Queued execution
  • Retry on 429 errors

Error Handling

try {
  // @ts-expect-error - testing invalid season
  await getSeasonalAnime(2024, 'autumn');
} catch (error) {
  // TypeScript prevents this at compile time
  console.error('Invalid season name');
}

API Endpoints

These functions call the following Jikan endpoints: getSeasonalAnime()
GET https://api.jikan.moe/v4/seasons/{year}/{season}
getCurrentSeasonAnime()
GET https://api.jikan.moe/v4/seasons/now
Documentation: Jikan Seasons API

See Also

searchAnime()

Search anime by title or keyword

getTopAnime()

Get highest-rated anime

Browse Anime

User guide for discovering seasonal anime

API Overview

Complete API reference

Build docs developers (and LLMs) love