Skip to content

v2.2.0 — Streaming Resolver, M3U8 Proxy & Full Diagnostic Sweep

Choose a tag to compare

@Shineii86 Shineii86 released this 28 Jul 15:36
· 34 commits to main since this release

AniKotoAPI v2.2.0

A massive update with streaming URL resolution, M3U8/TS proxy for CORS-free playback, 5 new endpoints, a full diagnostic sweep fixing 8 bugs, and complete modularization of the codebase.


What's New

Streaming URL Resolver

The /api/stream endpoint now has a companion resolver that takes embed URLs and returns actual video file URLs (m3u8/mp4).

Endpoint Description
GET /api/stream/resolve?id=&slug= Resolve embed URL to actual m3u8/mp4 video URL
GET /api/stream/qualities?url= Parse M3U8 playlist for available quality options (360p, 480p, 720p, 1080p)
GET /api/stream/proxy?url= M3U8 playlist proxy — rewrites relative URLs for CORS-free HLS playback
GET /api/stream/ts-proxy?url= TS video segment proxy with proper Content-Type and CORS headers

How it works:

/api/stream?id={link_id}           →  embed URL (vidtube.site/stream/...)
/api/stream/resolve?id={link_id}   →  actual video URL (m3u8/mp4)
/api/stream/proxy?url={m3u8_url}   →  rewritten M3U8 with proxy URLs

The M3U8 proxy fetches playlists from the source, rewrites all relative .m3u8 and .ts URLs to proxy through our API, and adds CORS headers — enabling browser playback of HLS streams that would otherwise be blocked by CORS.

New Endpoints (5)

Endpoint Description
GET /api/upcoming Upcoming anime releases sorted by air date
GET /api/top-rankings Top-ranked anime from sidebar with rank numbers
GET /api/recently-updated?tab=all|sub|dub Recently updated anime with tab filtering
GET /api/completed Finished anime series sorted by score
GET /api/stream/resolve Resolve embed URLs to actual video URLs

Total: 38 endpoints (up from 33)


Bug Fixes (from Full Diagnostic Sweep)

Bug Fix
/api/watch 500 error Path format changed from /slug/ep to /slug/ep-N
/api/info 400 error Now accepts both ?id= and ?slug= params
/api/status/airing 500 Added status name mapping (ongoing→currently-airing)
/api/top-rankings 0 items Fixed selectors to #top-anime .scaff.side.items a.item
/api/completed 0 items Fixed selectors for section.top-table[data-name=completed]
/api/recently-updated 0 items Fixed selectors for #recent-update .ani.items .item
parseListItem self-anchor Added detection when item IS the <a> tag
/api/cache/stats 404 Added missing endpoint to apiRoutes.js

Stream Info Improvements

  • Session establishment: streamInfo.extractor.js now fetches the watch page first to establish session cookies before AJAX calls
  • Server name normalization: Display names mapped to clean identifiers (VidPlay-1 → vidplay, HD-1 → hd)
  • Type field: Server objects now include type: "hls" or type: "mp4" based on file extension
  • Subtitle extraction: Subtitle tracks extracted from streaming API responses

Mirror Fallback Fix

The mirror helper previously marked mirrors as "failed" when they returned 404 responses. This caused all 5 mirrors to be marked as failed when endpoints like /api/seasons or /api/watch-order returned 404 (because the AJAX endpoints don't exist on the source site).

Fix: 404 responses no longer mark mirrors as failed. Only connection errors trigger mirror failover.


Codebase Modularization

Shared Helpers

  • parseListItem.helper.js — Unified list item parser with self-anchor detection, eliminating ~200 lines of duplicated code across 8+ extractors
  • mirror.helper.js — All 22+ extractors now use fetchWithMirror() for consistent mirror fallback

Extractor Rewrites

  • seasons.extractor.js — Now extracts from watch page sidebar (AJAX endpoints don't exist on source site)
  • watchOrder.extractor.js — Now extracts from watch page sidebar trending/related sections

Security & Performance

  • Graceful shutdown (SIGTERM/SIGINT handlers)
  • Request ID tracking (X-Request-Id header)
  • CSP and HSTS security headers
  • Body size limits (10kb)
  • Rate limiter cleanup (stale IP eviction every 5 min)
  • Uncaught exception handler
  • Removed unused cors dependency

Documentation

  • README.md: Version 2.2.0, 38 endpoints, streaming resolver/proxy docs
  • CHANGELOG.md: Full v2.2.0 entry
  • docs/endpoints.md: 8 new endpoint sections
  • docs/streaming.md: Stream URL resolution, M3U8 quality parsing, proxy docs
  • docs/architecture.md: Updated file structure, streaming flow, dependencies
  • docs/examples.md: New endpoint examples
  • agents/: Updated all agents to reference 38 endpoints

Test Results

34/34 endpoints passing with 0 errors in the full diagnostic sweep.


Full Changelog: https://github.com/Shineii86/AniKotoAPI/commits/v2.2.0