mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
README.md: - Version badge: 2.1.0 → 2.2.0 - Endpoint count: 33 → 38 - Feature table: added stream URL resolution, M3U8 proxy, season/epMin/epMax filters - Streaming section: added /stream/resolve, /stream/qualities, /stream/proxy docs - Project structure: updated controller/extractor/helper file lists - Dependencies: removed cors, updated dep list - Changelog highlights: added v2.2.0 entry - Completed checklist: added 38 endpoints, streaming resolver, proxy, diagnostic sweep docs/endpoints.md: - Added 8 new endpoint sections: upcoming, top-rankings, recently-updated, completed, stream/resolve, stream/qualities, stream/proxy, stream/ts-proxy docs/streaming.md: - Added Stream URL Resolution section (Step 4) - Added M3U8 quality parsing docs - Added M3U8 proxy docs with CORS-free playback explanation - Updated troubleshooting table docs/architecture.md: - Updated project structure with all new files (streamResolver, parseListItem, etc.) - Updated streaming flow diagram with resolver/proxy steps - Updated dependencies table docs/examples.md: - Added curl examples for upcoming, top-rankings, recently-updated, completed - Added stream resolver, qualities, proxy examples CHANGELOG.md: - Updated v2.2.0 entry with M3U8/TS proxy, mirror fix, all bug fixes agents/: - Updated api-tester.md: 36 → 38 endpoints - Updated technical-writer.md: 36 → 38 endpoints - Updated performance-benchmarker.md: 36 → 38 endpoints
10 KiB
10 KiB
Code Examples
All examples are tested and working with the live API.
cURL
Homepage
curl "https://anikototvapi.vercel.app/api"
Search
curl "https://anikototvapi.vercel.app/api/search?keyword=naruto"
Anime Info
curl "https://anikototvapi.vercel.app/api/info?id=naruto-eybxz"
Episodes
curl "https://anikototvapi.vercel.app/api/episodes/958"
Servers
SERVER_IDS=$(curl -s "https://anikototvapi.vercel.app/api/episodes/958" | python3 -c "import sys,json; print(json.load(sys.stdin)['results']['episodes'][0]['server_ids'])")
curl "https://anikototvapi.vercel.app/api/servers?ids=$SERVER_IDS"
Stream URL
LINK_ID=$(curl -s "https://anikototvapi.vercel.app/api/episodes/958" | python3 -c "import sys,json; print(json.load(sys.stdin)['results']['episodes'][0]['server_ids'])" | xargs -I{} curl -s "https://anikototvapi.vercel.app/api/servers?ids={}" | python3 -c "import sys,json; print(json.load(sys.stdin)['results'][0]['link_id'])")
curl "https://anikototvapi.vercel.app/api/stream?id=$LINK_ID"
Random Anime
curl "https://anikototvapi.vercel.app/api/random"
Schedule
curl "https://anikototvapi.vercel.app/api/schedule"
Suggestions
curl "https://anikototvapi.vercel.app/api/suggestions?keyword=one+piece"
Top 10
curl "https://anikototvapi.vercel.app/api/top-ten"
Filter by Genre
curl "https://anikototvapi.vercel.app/api/genre/action"
Filter with Parameters
curl "https://anikototvapi.vercel.app/api/filter?keyword=&genre[]=1&type=tv&status=aired"
JavaScript (Browser)
Homepage
async function getHomepage() {
const res = await fetch('https://anikototvapi.vercel.app/api');
const data = await res.json();
console.log('Spotlights:', data.results.spotlights.length);
console.log('Trending:', data.results.trending.length);
console.log('Top Airing:', data.results.topAiring.length);
console.log('Genres:', data.results.genres.length);
return data.results;
}
getHomepage();
Search
async function searchAnime(keyword) {
const res = await fetch(`https://anikototvapi.vercel.app/api/search?keyword=${encodeURIComponent(keyword)}`);
const data = await res.json();
return data.results.data.map(anime => ({
title: anime.title,
slug: anime.slug,
sub: anime.sub,
dub: anime.dub,
type: anime.type
}));
}
searchAnime('naruto').then(results => {
results.forEach(a => console.log(`${a.title} (${a.type}) — Sub: ${a.sub}, Dub: ${a.dub}`));
});
Anime Info
async function getAnimeInfo(slug) {
const res = await fetch(`https://anikototvapi.vercel.app/api/info?id=${slug}`);
const data = await res.json();
const info = data.results;
console.log(`Title: ${info.title}`);
console.log(`Type: ${info.type}`);
console.log(`Status: ${info.status}`);
console.log(`Episodes: ${info.totalEpisodes || 'Unknown'}`);
console.log(`MAL ID: ${info.malId}`);
return info;
}
getAnimeInfo('naruto-eybxz');
Full Streaming Flow
async function getStreamUrl(animeId) {
// Step 1: Get episodes
const episodesRes = await fetch(`https://anikototvapi.vercel.app/api/episodes/${animeId}`);
const episodesData = await episodesRes.json();
const episodes = episodesData.results.episodes;
if (!episodes || episodes.length === 0) {
throw new Error('No episodes found');
}
// Use first episode's server_ids
const serverIds = episodes[0].server_ids;
// Step 2: Get servers
const serversRes = await fetch(`https://anikototvapi.vercel.app/api/servers?ids=${serverIds}`);
const serversData = await serversRes.json();
const servers = serversData.results;
if (!servers || servers.length === 0) {
throw new Error('No servers found');
}
// Pick first server
const linkId = servers[0].link_id;
// Step 3: Get stream URL
const streamRes = await fetch(`https://anikototvapi.vercel.app/api/stream?id=${linkId}`);
const streamData = await streamRes.json();
return streamData.results.url;
}
// Usage
getStreamUrl(958)
.then(url => {
console.log('Stream URL:', url);
// Use with video player
})
.catch(err => console.error('Error:', err.message));
Random Anime
async function getRandomAnime() {
const res = await fetch('https://anikototvapi.vercel.app/api/random');
const data = await res.json();
const anime = data.results;
console.log(`Random: ${anime.title} (${anime.type})`);
console.log('Genres:', anime.genres.join(', '));
return anime;
}
getRandomAnime();
Filter by Genre
async function getAnimeByGenre(genre, page = 1) {
const res = await fetch(`https://anikototvapi.vercel.app/api/genre/${genre}?page=${page}`);
const data = await res.json();
return data.results.data.map(anime => ({
title: anime.title,
sub: anime.sub,
dub: anime.dub
}));
}
getAnimeByGenre('action').then(anime => {
console.log('Action Anime:');
anime.forEach(a => console.log(`- ${a.title} (Sub: ${a.sub}, Dub: ${a.dub})`));
});
Node.js (with axios)
Homepage
const axios = require('axios');
async function getHomepage() {
const { data } = await axios.get('https://anikototvapi.vercel.app/api');
console.log('Spotlights:', data.results.spotlights.length);
console.log('Trending:', data.results.trending.length);
return data.results;
}
getHomepage();
Search
const axios = require('axios');
async function searchAnime(keyword) {
const { data } = await axios.get('https://anikototvapi.vercel.app/api/search', {
params: { keyword }
});
return data.results.data;
}
searchAnime('naruto').then(results => {
results.forEach(a => console.log(`${a.title} (${a.type})`));
});
Full Streaming Flow
const axios = require('axios');
async function getStreamUrl(animeId) {
const BASE = 'https://anikototvapi.vercel.app/api';
// Step 1: Get episodes
const { data: episodesData } = await axios.get(`${BASE}/episodes/${animeId}`);
const episodes = episodesData.results.episodes;
if (!episodes || episodes.length === 0) {
throw new Error('No episodes found');
}
const serverIds = episodes[0].server_ids;
// Step 2: Get servers
const { data: serversData } = await axios.get(`${BASE}/servers`, {
params: { ids: serverIds }
});
const servers = serversData.results;
if (!servers || servers.length === 0) {
throw new Error('No servers found');
}
const linkId = servers[0].link_id;
// Step 3: Get stream URL
const { data: streamData } = await axios.get(`${BASE}/stream`, {
params: { id: linkId }
});
return streamData.results.url;
}
// Usage
getStreamUrl(958)
.then(url => console.log('Stream URL:', url))
.catch(err => console.error('Error:', err.message));
Episode List
const axios = require('axios');
async function getEpisodeList(animeId) {
const { data } = await axios.get(`https://anikototvapi.vercel.app/api/episodes/${animeId}`);
const { animeId: id, totalEpisodes, episodes } = data.results;
console.log(`Anime ID: ${id}`);
console.log(`Total Episodes: ${totalEpisodes}`);
console.log(`Episodes available: ${episodes.length}`);
episodes.forEach(ep => {
console.log(` Episode ${ep.episode_no}: server_ids available = ${!!ep.server_ids}`);
});
return data.results;
}
getEpisodeList(958);
Suggestions
const axios = require('axios');
async function getSuggestions(keyword) {
const { data } = await axios.get('https://anikototvapi.vercel.app/api/suggestions', {
params: { keyword }
});
return data.results;
}
getSuggestions('one piece').then(suggestions => {
suggestions.forEach(a => console.log(`${a.title} (${a.slug})`));
});
Schedule
const axios = require('axios');
async function getSchedule() {
const { data } = await axios.get('https://anikototvapi.vercel.app/api/schedule');
console.log('Scheduled anime:', data.results.length);
return data.results;
}
getSchedule();
Latest Updated
const axios = require('axios');
async function getLatestUpdated(page = 1) {
const { data } = await axios.get('https://anikototvapi.vercel.app/api/latest-updated', {
params: { page }
});
console.log('Recently updated anime:', data.results.length);
return data.results;
}
getLatestUpdated();
Seasons
const axios = require('axios');
async function getSeasons(animeId) {
const { data } = await axios.get(`https://anikototvapi.vercel.app/api/seasons/${animeId}`);
console.log('Seasons:', data.results.length);
return data.results;
}
getSeasons(1642);
Watch Order
const axios = require('axios');
async function getWatchOrder(animeId) {
const { data } = await axios.get(`https://anikototvapi.vercel.app/api/watch-order/${animeId}`);
console.log('Watch order entries:', data.results.length);
return data.results;
}
getWatchOrder(1642);
Download Links
const axios = require('axios');
async function getDownloadLinks(slug, episode) {
const { data } = await axios.get('https://anikototvapi.vercel.app/api/download', {
params: { slug, ep: episode }
});
console.log('Download links:', data.results);
return data.results;
}
getDownloadLinks('one-piece-odmau', 1165);
Upcoming Anime
curl "https://anikototvapi.vercel.app/api/upcoming"
Top Rankings
curl "https://anikototvapi.vercel.app/api/top-rankings"
Recently Updated
curl "https://anikototvapi.vercel.app/api/recently-updated?tab=sub"
Completed Anime
curl "https://anikototvapi.vercel.app/api/completed"
Stream URL Resolution
# Resolve embed URL to actual video URL
curl "https://anikototvapi.vercel.app/api/stream/resolve?id=MTF1dkFtaW9BRTZPbzJJRElFZUZr..."
# Get quality options
curl "https://anikototvapi.vercel.app/api/stream/qualities?url=https://example.com/playlist.m3u8"
# Proxy M3U8 for CORS-free playback
curl "https://anikototvapi.vercel.app/api/stream/proxy?url=https://example.com/playlist.m3u8"