mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 02:45:10 +00:00
feat: v2.5.1 — domain sync, spotlight fix, embed providers, info IDs, latest-episode checker, full docs pass
- Sync mirror domains with official hub (anikoto.site): replace dead
anikoto.se with official anikototv.se (dataUrl.js, render.yaml, README)
- Fix redesigned #hotest spotlight carousel selectors in homeInfo and
spotlight extractors (dual-selector fallback for old layout)
- New GET /api/stream/embeds: iframe-ready Megavid/AniXo/MegaPlay URLs
that bypass Cloudflare; ?slug= auto-resolves MAL/AniList IDs (cached),
or pass ?mal=/?anilist= directly with zero scraping
- GET /api/info now returns externalIds { animeId, malId, anilistId }
for direct feed into /api/stream/embeds (best-effort, 60min cache)
- New GET /api/episodes/latest?slug=: newest-episode checker for bot
polling — latest episode + counts only (10min cache), registered
before /episodes/:id so the literal path wins
- Top rankings ?sort=day|week|month verified already supported (docs)
- Full repo-style documentation on all new modules (box headers, FEATURE
markers, NOTE/TIP inline notes, JSDoc, footers)
- Diagnostic sweep: all counts synced to 40 endpoints / 30 handlers /
29 scrapers, stale badges and sample responses fixed, render.yaml EOF,
Dockerfile node:18-alpine (EOL) -> node:22-alpine
- Tests: 38 passed / 0 failed / 2 optional skips; 77 JS files syntax-OK
This commit is contained in:
+12
-7
@@ -67,13 +67,13 @@
|
||||
* │ │ │ │ │
|
||||
* │ │ ▼ │ │
|
||||
* │ │ ┌──────────────────────────────────────────────────────────┐ │ │
|
||||
* │ │ │ CONTROLLER LAYER (28 controllers) │ │ │
|
||||
* │ │ │ CONTROLLER LAYER (30 controllers) │ │ │
|
||||
* │ │ │ Validation · Parameter parsing · Response formatting │ │ │
|
||||
* │ │ └──────────────────────┬───────────────────────────────────┘ │ │
|
||||
* │ │ │ │ │
|
||||
* │ │ ▼ │ │
|
||||
* │ │ ┌──────────────────────────────────────────────────────────┐ │ │
|
||||
* │ │ │ EXTRACTOR / SCRAPER LAYER (28 extractors) │ │ │
|
||||
* │ │ │ EXTRACTOR / SCRAPER LAYER (29 extractors) │ │ │
|
||||
* │ │ │ HTML fetching · Cheerio parsing · Data transformation │ │ │
|
||||
* │ │ └──────────────────────┬───────────────────────────────────┘ │ │
|
||||
* │ │ │ │ │
|
||||
@@ -180,15 +180,18 @@
|
||||
* ├── src/
|
||||
* │ ├── configs/
|
||||
* │ │ ├── header.config.js # Default HTTP headers for upstream requests
|
||||
* │ │ └── ids.config.js # Genre / Type / Status numeric ID mappings
|
||||
* │ ├── controllers/ # 28 route handlers (one per endpoint)
|
||||
* │ │ ├── ids.config.js # Genre / Type / Status numeric ID mappings
|
||||
* │ │ └── embedProviders.config.js # Direct embed provider registry (Megavid/AniXo/MegaPlay)
|
||||
* │ ├── controllers/ # 30 route handlers (one per endpoint)
|
||||
* │ │ ├── homeInfo.controller.js
|
||||
* │ │ ├── animeInfo.controller.js
|
||||
* │ │ ├── search.controller.js
|
||||
* │ │ ├── episodeList.controller.js
|
||||
* │ │ ├── episodeLatest.controller.js
|
||||
* │ │ ├── episodeListAjax.controller.js
|
||||
* │ │ ├── streamInfo.controller.js
|
||||
* │ │ ├── streamResolver.controller.js
|
||||
* │ │ ├── embedProviders.controller.js
|
||||
* │ │ ├── schedule.controller.js
|
||||
* │ │ ├── spotlight.controller.js
|
||||
* │ │ ├── trending.controller.js
|
||||
@@ -210,7 +213,7 @@
|
||||
* │ │ ├── recentlyUpdatedTabs.controller.js
|
||||
* │ │ ├── completedAnime.controller.js
|
||||
* │ │ └── category.controller.js
|
||||
* │ ├── extractors/ # 28 HTML scrapers (one per data source)
|
||||
* │ ├── extractors/ # 29 HTML scrapers (one per data source)
|
||||
* │ │ ├── homeInfo.extractor.js
|
||||
* │ │ ├── animeInfo.extractor.js
|
||||
* │ │ ├── search.extractor.js
|
||||
@@ -218,6 +221,7 @@
|
||||
* │ │ ├── episodeListAjax.extractor.js
|
||||
* │ │ ├── streamInfo.extractor.js
|
||||
* │ │ ├── streamResolver.extractor.js
|
||||
* │ │ ├── embedProviders.extractor.js
|
||||
* │ │ ├── schedule.extractor.js
|
||||
* │ │ ├── spotlight.extractor.js
|
||||
* │ │ ├── trending.extractor.js
|
||||
@@ -308,7 +312,7 @@
|
||||
* └────────────────────────────────────────────────────────────────────────┘
|
||||
*
|
||||
* ┌────────────────────────────────────────────────────────────────────────┐
|
||||
* │ Extractors (28 scrapers) │
|
||||
* │ Extractors (29 scrapers) │
|
||||
* ├────────────────────────────────────────────────────────────────────────┤
|
||||
* │ One extractor per data source on the target site. Responsibilities: │
|
||||
* │ • Build the upstream URL (via mirror.helper) │
|
||||
@@ -861,7 +865,8 @@
|
||||
* │ Search & Filter │ search, filter, azList, category │
|
||||
* │ Anime Detail │ animeInfo, watchPage, status │
|
||||
* │ Episode & Stream │ episodeList, episodeListAjax, │
|
||||
* │ │ streamInfo, streamResolver, download │
|
||||
* │ │ streamInfo, streamResolver, download,│
|
||||
* │ │ embedProviders │
|
||||
* │ Lists │ newRelease, trendingSidebar, │
|
||||
* │ │ topAnimeRankings, recentlyUpdated, │
|
||||
* │ │ completedAnime, upcomingAnime │
|
||||
|
||||
+92
-3
@@ -164,7 +164,7 @@ curl "https://anikototvapi.vercel.app/api/search?keyword=naruto"
|
||||
|
||||
## GET /info
|
||||
|
||||
Get detailed info about an anime.
|
||||
Get detailed info about an anime. Includes `externalIds` (MAL/AniList IDs) that can be passed directly to `/stream/embeds`.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
@@ -172,6 +172,8 @@ Get detailed info about an anime.
|
||||
|
||||
> **Important:** Slugs now include random hashes (e.g., `one-piece-odmau`). Get valid slugs from `/search` or `/most-popular` results.
|
||||
|
||||
> **Note:** `externalIds` is resolved server-side (cached 60 min) and is best-effort — if ID resolution fails it comes back as `null` values, the rest of the response is unaffected.
|
||||
|
||||
**Request:**
|
||||
|
||||
```bash
|
||||
@@ -203,7 +205,12 @@ curl "https://anikototvapi.vercel.app/api/info?id=naruto-shippuuden-movie-6-road
|
||||
"producers": ["TV Tokyo", "Shueisha"],
|
||||
"genres": ["Action", "Comedy", "Supernatural"],
|
||||
"rating": "PG-13",
|
||||
"reviewCount": "0"
|
||||
"reviewCount": "0",
|
||||
"externalIds": {
|
||||
"animeId": 1642,
|
||||
"malId": "21",
|
||||
"anilistId": "21"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -254,6 +261,46 @@ curl "https://anikototvapi.vercel.app/api/episodes/958"
|
||||
|
||||
---
|
||||
|
||||
## GET /episodes/latest
|
||||
|
||||
Latest-episode checker — returns only the newest episode plus summary counts. Built for bots and notification jobs ("is there a new episode?") that shouldn't download the full episode list.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `slug` | string | Yes | Anime slug or animeId |
|
||||
|
||||
**Request:**
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/episodes/latest?slug=one-piece-odmau"
|
||||
```
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"results": {
|
||||
"slug": "one-piece-odmau",
|
||||
"animeId": 1642,
|
||||
"totalEpisodes": 1165,
|
||||
"latest": {
|
||||
"episode_no": 1165,
|
||||
"title": "",
|
||||
"id": "50167",
|
||||
"slug": "1165",
|
||||
"href": "#",
|
||||
"server_ids": "dXNCT3hNQzk3THhSTW8ySnM5...",
|
||||
"mal_id": "21"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
> **Tip:** Poll this endpoint, compare `results.latest.episode_no` with your stored value, and call `/servers?ids=results.latest.server_ids` only when it changes. Responses are cached for 10 minutes.
|
||||
|
||||
---
|
||||
|
||||
## GET /servers
|
||||
|
||||
Get available servers for an episode.
|
||||
@@ -835,6 +882,48 @@ Returns array of quality objects with url, quality label, resolution, bandwidth,
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/embeds
|
||||
|
||||
Direct embed provider URLs (Megavid / AniXo / MegaPlay) — iframe-ready players that bypass Cloudflare entirely. Playback happens inside the provider's own iframe; no source-site AJAX scraping at watch time.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `slug` | string | One of* | Anime slug — MAL/AniList IDs resolved automatically |
|
||||
| `mal` | string | One of* | Direct MAL ID (skips slug lookup) |
|
||||
| `anilist` | string | One of* | Direct AniList ID (skips slug lookup) |
|
||||
| `ep` | number | No | Episode number (default 1) |
|
||||
| `lang` | string | No | `sub` or `dub` (default `sub`) |
|
||||
| `provider` | string | No | Comma-separated filter: `megaplay`, `anixo`, `megavid` |
|
||||
|
||||
\* Provide at least one of `slug`, `mal`, or `anilist`.
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/embeds?slug=one-piece-odmau&ep=1"
|
||||
curl "https://anikototvapi.vercel.app/api/stream/embeds?mal=21&ep=1&lang=dub&provider=megavid"
|
||||
```
|
||||
|
||||
Returns resolved IDs plus iframe-ready URLs per provider:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"results": {
|
||||
"slug": "one-piece-odmau",
|
||||
"episode": 1,
|
||||
"lang": "sub",
|
||||
"ids": { "animeId": 1642, "malId": "21", "anilistId": "21" },
|
||||
"providers": [
|
||||
{ "id": "megaplay", "name": "MegaPlay", "url": "https://megaplay.buzz/stream/mal/21/1/sub", "iframeReady": true },
|
||||
{ "id": "anixo", "name": "AniXo", "url": "https://anixo.buzz/embed/ani/21/1/sub?color=%23e63946", "iframeReady": true },
|
||||
{ "id": "megavid", "name": "Megavid", "url": "https://megavid.buzz/mal/21/1/sub?color=%23e63946&autoplay=true", "iframeReady": true }
|
||||
],
|
||||
"unavailable": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/proxy
|
||||
|
||||
M3U8 playlist proxy — rewrites relative URLs to proxy endpoints for CORS-free playback.
|
||||
@@ -924,7 +1013,7 @@ curl "https://anikototvapi.vercel.app/api/stats"
|
||||
"ttl": "5 minutes",
|
||||
"description": "Map-based cache with TTL expiration"
|
||||
},
|
||||
"endpoints": 38,
|
||||
"endpoints": 40,
|
||||
"timestamp": "2026-07-30T02:20:46.205Z"
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -7,7 +7,7 @@
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
> A fast, free REST API that scrapes anime data from **anikototv.to**.
|
||||
@@ -70,9 +70,9 @@ That's it. No API keys required.
|
||||
|
||||
| Feature | Description |
|
||||
|---|---|
|
||||
| **38+ Endpoints** | Full coverage of anime data, streaming, and discovery |
|
||||
| **28 HTML Scrapers** | Cheerio-based scrapers for robust data extraction |
|
||||
| **28 Route Handlers** | Organized controllers with clean separation of concerns |
|
||||
| **40+ Endpoints** | Full coverage of anime data, streaming, and discovery |
|
||||
| **29 HTML Scrapers** | Cheerio-based scrapers for robust data extraction |
|
||||
| **30 Route Handlers** | Organized controllers with clean separation of concerns |
|
||||
| **5 Mirror Domains** | Automatic failover across multiple source domains |
|
||||
| **LRU Cache** | Per-endpoint TTL caching for performance |
|
||||
| **Rate Limiting** | 100 requests per 15 minutes per IP |
|
||||
@@ -194,12 +194,12 @@ AniKotoAPI/
|
||||
│ ├── info.js # Anime info
|
||||
│ ├── search.js # Search
|
||||
│ ├── stream.js # Streaming
|
||||
│ └── ... # 38+ route handlers
|
||||
│ └── ... # 40 route handlers
|
||||
├── scrapers/ # Cheerio HTML scrapers
|
||||
│ ├── home.js
|
||||
│ ├── info.js
|
||||
│ ├── search.js
|
||||
│ └── ... # 28 scrapers
|
||||
│ └── ... # 29 scrapers
|
||||
├── utils/ # Shared utilities
|
||||
│ ├── cache.js # LRU cache with TTL
|
||||
│ ├── rateLimit.js # IP-based rate limiter
|
||||
@@ -218,8 +218,8 @@ AniKotoAPI/
|
||||
|
||||
### Key Design Patterns
|
||||
|
||||
- **Scraping Layer**: 28 Cheerio-based scrapers parse HTML from anikototv.to, isolating page-specific logic from route handlers.
|
||||
- **Controller Layer**: 28 route handlers map HTTP requests to scraper calls, handle validation, and format responses.
|
||||
- **Scraping Layer**: 29 Cheerio-based scrapers parse HTML from anikototv.to, isolating page-specific logic from route handlers.
|
||||
- **Controller Layer**: 30 route handlers map HTTP requests to scraper calls, handle validation, and format responses.
|
||||
- **Cache Layer**: LRU cache with per-endpoint TTL reduces redundant scraping. Hot endpoints cache for 2–5 minutes; cold endpoints for 10+ minutes.
|
||||
- **Mirror Layer**: 5 source domains with automatic failover. If one domain is slow or down, requests transparently fall back to the next mirror.
|
||||
- **Rate Limiter**: Token bucket algorithm, 100 requests per 15-minute window per client IP.
|
||||
@@ -350,7 +350,7 @@ All errors return JSON with a consistent structure:
|
||||
|
||||
| File | Description |
|
||||
|------|-------------|
|
||||
| [endpoints.md](./endpoints.md) | Full API reference for all 38+ endpoints |
|
||||
| [endpoints.md](./endpoints.md) | Full API reference for all 40+ endpoints |
|
||||
| [streaming.md](./streaming.md) | Complete streaming workflow guide |
|
||||
| [examples.md](./examples.md) | Working code examples in cURL, JS, Python |
|
||||
| [architecture.md](./architecture.md) | Project structure and design patterns |
|
||||
|
||||
+47
-6
@@ -15,6 +15,8 @@ This document covers the complete streaming workflow for AniKotoAPI — from sea
|
||||
## ⚠️ Streaming Status
|
||||
|
||||
> **Streaming endpoints (`/api/servers`, `/api/stream`, `/api/stream/resolve`) return errors when anikototv.to blocks AJAX requests from server-side IPs.**
|
||||
>
|
||||
> **✅ Alternative: `/api/stream/embeds` never touches AniKoto's AJAX layer** — see [Direct Embed Providers](#direct-embed-providers).
|
||||
|
||||
| What Works | What's Blocked |
|
||||
|:---|:---|
|
||||
@@ -24,6 +26,7 @@ This document covers the complete streaming workflow for AniKotoAPI — from sea
|
||||
| Top 10, most popular, new release | `/api/mapper-servers` — gogoanime servers |
|
||||
| AZ list, random, genre list | All AJAX-dependent endpoints |
|
||||
| All HTML-scraped endpoints | |
|
||||
| **`/api/stream/embeds` — direct provider iframes** | |
|
||||
|
||||
**To fix streaming**, set one of these environment variables:
|
||||
|
||||
@@ -35,17 +38,55 @@ SCRAPER_API_KEY=your_scraperapi_key
|
||||
FLARESOLVERR_URL=http://your-flaresolverr-host:8191
|
||||
```
|
||||
|
||||
Or use the Cloudflare-free embed providers below — no proxy needed.
|
||||
|
||||
---
|
||||
|
||||
## Direct Embed Providers
|
||||
|
||||
`GET /api/stream/embeds` builds iframe-ready player URLs for three third-party providers. Playback happens inside the provider's own iframe, so nothing ever requests AniKoto's Cloudflare-protected AJAX endpoints at watch time.
|
||||
|
||||
| Provider | URL pattern | Requires |
|
||||
|:---|:---|:---|
|
||||
| **MegaPlay** | `megaplay.buzz/stream/mal\|ani/{id}/{ep}/{lang}` | MAL or AniList ID |
|
||||
| **AniXo** | `anixo.buzz/embed/ani/{anilistId}/{ep}/{lang}` | AniList ID |
|
||||
| **Megavid** | `megavid.buzz/{mal\|ani}/{id}/{ep}/{lang}` | MAL or AniList ID |
|
||||
|
||||
```bash
|
||||
# From an AniKoto slug (MAL/AniList IDs resolved automatically, cached 60min)
|
||||
curl ".../api/stream/embeds?slug=one-piece-odmau&ep=1"
|
||||
|
||||
# From direct IDs — zero scraping, instant response
|
||||
curl ".../api/stream/embeds?mal=21&ep=1&lang=dub&provider=megavid,megaplay"
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"results": {
|
||||
"ids": { "animeId": 1642, "malId": "21", "anilistId": "21" },
|
||||
"providers": [
|
||||
{ "id": "megaplay", "url": "https://megaplay.buzz/stream/mal/21/1/sub", "iframeReady": true },
|
||||
{ "id": "anixo", "url": "https://anixo.buzz/embed/ani/21/1/sub?color=%23e63946", "iframeReady": true },
|
||||
{ "id": "megavid", "url": "https://megavid.buzz/mal/21/1/sub?color=%23e63946&autoplay=true", "iframeReady": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Drop any `url` straight into an `<iframe allow="autoplay; fullscreen">` — all three are embed-only players (Megavid rejects bare curl with 403 by design; browsers load it fine).
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Architecture Overview](#architecture-overview)
|
||||
2. [Streaming Workflow](#streaming-workflow)
|
||||
3. [Endpoint Reference](#endpoint-reference)
|
||||
4. [M3U8 Proxy](#m3u8-proxy)
|
||||
5. [Video Player Integration](#video-player-integration)
|
||||
6. [Error Handling](#error-handling)
|
||||
7. [Performance Tips](#performance-tips)
|
||||
2. [Direct Embed Providers](#direct-embed-providers)
|
||||
3. [Streaming Workflow](#streaming-workflow)
|
||||
4. [Endpoint Reference](#endpoint-reference)
|
||||
5. [M3U8 Proxy](#m3u8-proxy)
|
||||
6. [Video Player Integration](#video-player-integration)
|
||||
7. [Error Handling](#error-handling)
|
||||
8. [Performance Tips](#performance-tips)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user