feat(jikan): add advanced search and video episodes support

This commit is contained in:
2026-05-01 17:26:53 +02:00
committed by Mikkel Elvers
parent 6bdf3344d2
commit 394aad7793
3 changed files with 71 additions and 6 deletions

View File

@@ -19,6 +19,19 @@ func (c *Client) GetEpisodes(ctx context.Context, animeID int, page int) (Episod
return result, err
}
func (c *Client) GetVideoEpisodes(ctx context.Context, animeID int, page int) (EpisodesResponse, error) {
if page < 1 {
page = 1
}
cacheKey := fmt.Sprintf("anime:%d:videos:episodes:%d", animeID, page)
var result EpisodesResponse
reqURL := fmt.Sprintf("%s/anime/%d/videos/episodes?page=%d", c.baseURL, animeID, page)
err := c.getWithCache(ctx, cacheKey, 12*time.Hour, reqURL, &result)
return result, err
}
func (c *Client) GetEpisode(ctx context.Context, animeID int, episode int) (EpisodeResponse, error) {
cacheKey := fmt.Sprintf("anime:%d:episode:%d", animeID, episode)
var result EpisodeResponse