mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +00:00
docs: Update all documentation for v2.2.0 — 38 endpoints, streaming resolver, proxy
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
This commit is contained in:
+43
-20
@@ -21,8 +21,8 @@ AniKotoAPI/
|
||||
│
|
||||
├── docs/ # API documentation
|
||||
│ ├── index.md # Overview, quick start, features
|
||||
│ ├── endpoints.md # Full API reference (33 endpoints)
|
||||
│ ├── streaming.md # Streaming flow guide (3-step)
|
||||
│ ├── endpoints.md # Full API reference (38 endpoints)
|
||||
│ ├── streaming.md # Streaming flow guide + resolver/proxy
|
||||
│ ├── examples.md # cURL, JavaScript, Python, Node.js
|
||||
│ └── architecture.md # This file
|
||||
│
|
||||
@@ -30,65 +30,76 @@ AniKotoAPI/
|
||||
│ ├── configs/
|
||||
│ │ ├── dataUrl.js # URL patterns, BASE_URL: https://anikototv.to
|
||||
│ │ ├── header.config.js # Request headers (User-Agent, Referer, etc.)
|
||||
│ │ └── ids.config.js # Genre/type/status ID mappings
|
||||
│ │ └── ids.config.js # Genre/type/status/source/season ID mappings
|
||||
│ │
|
||||
│ ├── routes/
|
||||
│ │ ├── apiRoutes.js # All route definitions + OpenAPI spec
|
||||
│ │ ├── apiRoutes.js # All route definitions + OpenAPI spec (38 endpoints)
|
||||
│ │ └── category.route.js # genre/:name, type/:name, status/:name
|
||||
│ │
|
||||
│ ├── controllers/
|
||||
│ │ ├── homeInfo.controller.js # Homepage data
|
||||
│ │ ├── search.controller.js # Anime search
|
||||
│ │ ├── animeInfo.controller.js # Anime info
|
||||
│ │ ├── animeInfo.controller.js # Anime info (accepts ?id= or ?slug=)
|
||||
│ │ ├── episodeList.controller.js # Episode list
|
||||
│ │ ├── episodeListAjax.controller.js # AJAX episode list
|
||||
│ │ ├── servers.controller.js # Server list
|
||||
│ │ ├── stream.controller.js # Stream URL
|
||||
│ │ ├── streamResolver.controller.js # 🆕 Stream URL resolution + quality detection
|
||||
│ │ ├── suggestion.controller.js # Anime suggestions
|
||||
│ │ ├── spotlight.controller.js # Spotlight anime
|
||||
│ │ ├── trending.controller.js # Trending anime
|
||||
│ │ ├── topten.controller.js # Top 10
|
||||
│ │ ├── topAnimeRankings.controller.js # 🆕 Top rankings
|
||||
│ │ ├── upcomingAnime.controller.js # 🆕 Upcoming anime
|
||||
│ │ ├── recentlyUpdatedTabs.controller.js # 🆕 Recently updated with tabs
|
||||
│ │ ├── completedAnime.controller.js # 🆕 Completed anime
|
||||
│ │ ├── schedule.controller.js # Schedule
|
||||
│ │ ├── random.controller.js # Random anime
|
||||
│ │ ├── newRelease.controller.js # New releases + Latest Updated
|
||||
│ │ ├── popular.controller.js # Most popular
|
||||
│ │ ├── category.controller.js # Genre filter
|
||||
│ │ ├── category.controller.js # Type filter
|
||||
│ │ ├── category.controller.js # Status filter
|
||||
│ │ ├── category.controller.js # Genre/Type/Status filter
|
||||
│ │ └── filter.controller.js # Advanced filter
|
||||
│ │
|
||||
│ ├── extractors/
|
||||
│ │ ├── home.extractor.js # Homepage extraction
|
||||
│ │ ├── homeInfo.extractor.js # Homepage extraction
|
||||
│ │ ├── search.extractor.js # Search results
|
||||
│ │ ├── info.extractor.js # Anime details
|
||||
│ │ ├── animeInfo.extractor.js # Anime details
|
||||
│ │ ├── episodeList.extractor.js # Episode list + server_ids
|
||||
│ │ ├── episodeListAjax.extractor.js # AJAX episode list
|
||||
│ │ ├── serverList.extractor.js # Server list
|
||||
│ │ ├── streamInfo.extractor.js # Stream URL extraction
|
||||
│ │ ├── streamInfo.extractor.js # Stream URL extraction (with session cookies)
|
||||
│ │ ├── streamResolver.extractor.js # 🆕 Stream URL resolution, M3U8 parser, server normalization
|
||||
│ │ ├── spotlight.extractor.js # Spotlight anime
|
||||
│ │ ├── trending.extractor.js # Trending anime
|
||||
│ │ ├── topTen.extractor.js # Top 10
|
||||
│ │ ├── topAnimeRankings.extractor.js # 🆕 Top rankings from sidebar
|
||||
│ │ ├── upcomingAnime.extractor.js # 🆕 Upcoming anime
|
||||
│ │ ├── recentlyUpdatedTabs.extractor.js # 🆕 Recently updated with tab filtering
|
||||
│ │ ├── completedAnime.extractor.js # 🆕 Completed anime from top-table
|
||||
│ │ ├── schedule.extractor.js # Schedule
|
||||
│ │ ├── random.extractor.js # Random anime
|
||||
│ │ ├── newRelease.extractor.js # New releases + Latest Updated
|
||||
│ │ ├── mostPopular.extractor.js # Most popular
|
||||
│ │ ├── genre.extractor.js # Genre filter
|
||||
│ │ ├── type.extractor.js # Type filter
|
||||
│ │ ├── status.extractor.js # Status filter
|
||||
│ │ ├── filter.extractor.js # Advanced filter
|
||||
│ │ ├── filter.extractor.js # Advanced filter (with source/season params)
|
||||
│ │ ├── suggestion.extractor.js # Suggestions
|
||||
│ │ ├── seasons.extractor.js # Seasons/OVAs/movies
|
||||
│ │ ├── watchOrder.extractor.js # Watch order
|
||||
│ │ ├── seasons.extractor.js # Seasons from watch page sidebar
|
||||
│ │ ├── watchOrder.extractor.js # Watch order from watch page sidebar
|
||||
│ │ └── download.extractor.js # Download links
|
||||
│ │
|
||||
│ └── helper/
|
||||
│ ├── cache.helper.js # LRU cache with configurable TTL
|
||||
│ ├── mirror.helper.js # Multi-mirror fallback (5 domains)
|
||||
│ ├── mirror.helper.js # Multi-mirror fallback (5 domains, 404-safe)
|
||||
│ ├── extractPages.helper.js # Page fetching with mirror fallback
|
||||
│ ├── formatTitle.helper.js # Title formatter
|
||||
│ ├── countPages.helper.js # Pagination counter
|
||||
│ ├── parseListItem.helper.js # 🆕 Shared list item parser with self-anchor detection
|
||||
│ └── pagination.helper.js # Pagination metadata generator
|
||||
│
|
||||
│ └── middleware/
|
||||
│ └── creatorInfo.js # Creator attribution injection
|
||||
│
|
||||
├── test.js # Test suite (27 tests)
|
||||
├── test.js # Test suite (38 tests)
|
||||
├── agents/ # AI agent prompts (6 agents)
|
||||
└── CHANGELOG.md # Version history
|
||||
```
|
||||
@@ -150,7 +161,19 @@ Client Response
|
||||
↓
|
||||
/api/stream?id={link_id}
|
||||
↓
|
||||
Returns: url (stream link), skipData (intro/outro timestamps)
|
||||
Returns: url (embed URL), skipData (intro/outro timestamps)
|
||||
↓
|
||||
/api/stream/resolve?id={link_id} ← 🆕 Resolve to actual video URL
|
||||
↓
|
||||
Returns: url (m3u8/mp4), type, server name, subtitles
|
||||
↓
|
||||
/api/stream/qualities?url={m3u8_url} ← 🆕 Get quality options
|
||||
↓
|
||||
Returns: qualities array with resolution, bandwidth, codec
|
||||
↓
|
||||
/api/stream/proxy?url={m3u8_url} ← 🆕 CORS-free proxy
|
||||
↓
|
||||
Returns: rewritten M3U8 with proxy URLs
|
||||
```
|
||||
|
||||
## Caching Strategy
|
||||
@@ -229,6 +252,6 @@ Error responses:
|
||||
| express | ^4.21.0 | Web framework |
|
||||
| cheerio | ^1.0.0-rc.12 | HTML parsing |
|
||||
| axios | ^1.8.0 | HTTP requests |
|
||||
| cors | ^2.8.5 | CORS headers |
|
||||
| cookie-parser | ^1.4.7 | Cookie parsing |
|
||||
| dotenv | ^16.4.0 | Environment variables |
|
||||
| compression | ^1.7.4 | Response compression |
|
||||
|
||||
@@ -666,3 +666,133 @@ curl "https://anikototvapi.vercel.app/api/az-list/a"
|
||||
```
|
||||
|
||||
Returns paginated list of anime starting with the specified letter.
|
||||
|
||||
---
|
||||
|
||||
## GET /upcoming
|
||||
|
||||
Get upcoming anime sorted by air date.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | number | No | Page number (default: 1) |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/upcoming"
|
||||
```
|
||||
|
||||
Returns paginated list of upcoming anime with sub/dub counts, type, and rating.
|
||||
|
||||
---
|
||||
|
||||
## GET /top-rankings
|
||||
|
||||
Get top-ranked anime (source site's top section).
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | number | No | Page number (default: 1) |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/top-rankings"
|
||||
```
|
||||
|
||||
Returns paginated list with rank numbers extracted from CSS classes.
|
||||
|
||||
---
|
||||
|
||||
## GET /recently-updated
|
||||
|
||||
Get recently updated anime. Supports tab filtering.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `tab` | string | No | Filter: `sub`, `dub`, `all` (default: `all`) |
|
||||
| `page` | number | No | Page number (default: 1) |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/recently-updated"
|
||||
```
|
||||
|
||||
Returns paginated list from `#recent-update` section with client-side tab filtering.
|
||||
|
||||
---
|
||||
|
||||
## GET /completed
|
||||
|
||||
Get completed anime sorted by score.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | number | No | Page number (default: 1) |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/completed"
|
||||
```
|
||||
|
||||
Returns paginated list of finished anime from `section.top-table[data-name='completed']`.
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/resolve
|
||||
|
||||
Resolve an embed URL to actual video URL (m3u8/mp4).
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `id` | string | Yes | `link_id` from `/servers` response |
|
||||
| `slug` | string | No | Anime slug (for session cookies) |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/resolve?id=MTF1dkFtaW9BRTZPbzJJRElFZUZr..."
|
||||
```
|
||||
|
||||
Returns resolved URL, type (hls/mp4), server name, and subtitle URLs.
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/qualities
|
||||
|
||||
Parse M3U8 playlist for available quality options.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `url` | string | Yes | M3U8 playlist URL |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/qualities?url=https://example.com/playlist.m3u8"
|
||||
```
|
||||
|
||||
Returns array of quality objects with url, quality label, resolution, bandwidth, and codec.
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/proxy
|
||||
|
||||
M3U8 playlist proxy — rewrites relative URLs to proxy endpoints for CORS-free playback.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `url` | string | Yes | M3U8 playlist URL |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/proxy?url=https://example.com/playlist.m3u8"
|
||||
```
|
||||
|
||||
Returns rewritten M3U8 content with all `.m3u8` and `.ts` URLs pointing to proxy endpoints.
|
||||
|
||||
---
|
||||
|
||||
## GET /stream/ts-proxy
|
||||
|
||||
TS video segment proxy — serves `.ts` segments with proper Content-Type and CORS headers.
|
||||
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `url` | string | Yes | `.ts` segment URL |
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/ts-proxy?url=https://example.com/segment.ts"
|
||||
```
|
||||
|
||||
Returns binary video segment with `Content-Type: video/mp2t` and `Access-Control-Allow-Origin: *`.
|
||||
|
||||
@@ -427,3 +427,40 @@ async function getDownloadLinks(slug, episode) {
|
||||
|
||||
getDownloadLinks('one-piece-odmau', 1165);
|
||||
```
|
||||
|
||||
### Upcoming Anime
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/upcoming"
|
||||
```
|
||||
|
||||
### Top Rankings
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/top-rankings"
|
||||
```
|
||||
|
||||
### Recently Updated
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/recently-updated?tab=sub"
|
||||
```
|
||||
|
||||
### Completed Anime
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/completed"
|
||||
```
|
||||
|
||||
### Stream URL Resolution
|
||||
|
||||
```bash
|
||||
# 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"
|
||||
```
|
||||
|
||||
+59
-1
@@ -251,7 +251,65 @@ player.source = {
|
||||
| "No episodes found" | Check the anime ID is correct (use `/api/search` first to find slug, then use animeId) |
|
||||
| "No servers found" | The `server_ids` may be invalid, try another episode |
|
||||
| Stream URL 403 | Some servers require specific referrer headers |
|
||||
| CORS error | Use a proxy or access from server-side |
|
||||
| CORS error | Use `/api/stream/proxy` endpoint to proxy M3U8 playlists |
|
||||
|
||||
---
|
||||
|
||||
## Stream URL Resolution (v2.2.0)
|
||||
|
||||
The `/api/stream` endpoint returns an **embed URL** (e.g., `vidtube.site/stream/...`). To get the **actual video URL** (m3u8/mp4), use the resolver:
|
||||
|
||||
### Step 4: Resolve Embed URL to Video URL
|
||||
|
||||
```bash
|
||||
# Resolve embed URL to actual stream URL
|
||||
curl "https://anikototvapi.vercel.app/api/stream/resolve?id=MTF1dkFtaW9BRTZPbzJJRElFZUZr..."
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"results": {
|
||||
"url": "https://vid-tube.site/hls/b32de9d4a3230c95f52948373e6e1549.m3u8",
|
||||
"type": "hls",
|
||||
"server": "HD-1",
|
||||
"subtitles": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Get Quality Options
|
||||
|
||||
```bash
|
||||
curl "https://anikototvapi.vercel.app/api/stream/qualities?url=https://example.com/playlist.m3u8"
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"results": {
|
||||
"qualities": [
|
||||
{ "url": "https://example.com/360.m3u8", "quality": "360p", "width": 640, "height": 360 },
|
||||
{ "url": "https://example.com/720.m3u8", "quality": "720p", "width": 1280, "height": 720 }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### M3U8 Proxy (CORS-Free Playback)
|
||||
|
||||
Browser video players often can't fetch M3U8 playlists directly due to CORS. Use the proxy:
|
||||
|
||||
```bash
|
||||
# Proxy rewrites all relative URLs to go through our API
|
||||
curl "https://anikototvapi.vercel.app/api/stream/proxy?url=https://example.com/playlist.m3u8"
|
||||
```
|
||||
|
||||
The proxy:
|
||||
1. Fetches the M3U8 playlist
|
||||
2. Rewrites relative `.m3u8` URLs → `https://anikototvapi.vercel.app/api/stream/proxy?url=...`
|
||||
3. Rewrites `.ts` segment URLs → `https://anikototvapi.vercel.app/api/stream/ts-proxy?url=...`
|
||||
4. Returns the rewritten M3U8 content with CORS headers
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user