Commit Graph
12 Commits
Author SHA1 Message Date
Shinei Nouzen 75199d4dcd fix: add cookie-aware session establishment for stream AJAX endpoints
Root cause: upstream /ajax/server and /ajax/server/list endpoints require
session cookies set by visiting the watch page. fetchWithMirror() didn't
persist cookies between requests, causing upstream to return 500.

- Extract cookies from set-cookie headers when fetching watch/home page
- Pass cookies with AJAX requests for stream info and server list
- Accept optional slug query param in /api/stream for targeted session
- Both extractors now use cookie-aware axios for session establishment
2026-08-14 06:59:17 +05:30
Shinei Nouzen 320bf0915b fix: detect upstream API errors in stream endpoint to prevent null URL responses
- Added upstream error detection in streamInfo.extractor.js (status >= 400)
- Added non-JSON error string detection from upstream API
- Updated streamInfo.controller.js to return HTTP 502 for upstream failures
- Fixes /api/stream returning null URL when upstream returns error responses
2026-08-14 06:36:37 +05:30
Shinei Nouzen a8223acf92 fix: resolve null values in stream server endpoints
- Fix extractServerList JSON parsing: fetchWithMirror returns raw text but code treated it as parsed object, causing Cheerio to parse JSON string as HTML resulting in empty server arrays
- Fix extractMapperServers JSON parsing: same raw text issue caused data processing loop to be skipped, returning empty arrays
- Fix streamInfo controller to return 404 with error message when stream URL is null instead of silently returning null values
- Fix server list controller to use proper TTL and handle empty results
- Fix JSON.parse error handling in episodeList and episodeListAjax extractors
- Update CHANGELOG.md with v2.2.1 bug fixes
2026-08-12 22:59:18 +05:30
Shinei Nouzen bdf7e96ce9 feat: Add streaming URL resolver, quality detection, and server normalization
New endpoints:
- GET /api/stream/resolve — Resolves actual m3u8/mp4 URLs from embed player URLs
  Follows chain: vidtube.site → megaplay API → m3u8 playlist
  Returns url, type, qualities, subtitles, skipData
- GET /api/stream/qualities — Parses M3U8 playlists for available quality options
  Returns sorted quality list with resolution, bandwidth, URLs

New extractors:
- streamResolver.extractor.js — Full stream resolution pipeline
  - resolveStreamUrl(): Resolves embed → actual video URL
  - parseM3u8Qualities(): Parses master playlists for qualities
  - normalizeServerName(): Maps VidPlay-1 → vidplay, HD-1 → hd
  - extractSubtitles(): Extracts subtitle tracks from API responses

Enhancements:
- streamInfo.extractor.js: Added session establishment before AJAX calls
- Server list now includes normalizedName field for each server
- Stream info now includes type (hls/mp4) and backup URL
- Server list includes typeLabel (SUB/HSUB/DUB)
- Session cookies properly maintained for AJAX stream endpoints

Architecture:
- Embed API domain mapping (vidtube.site → megaplay-1.buzz)
- M3U8 parser supports master and media playlists
- Subtitle extraction from multiple API response formats
- 36 total endpoints (was 34)
2026-07-28 20:40:17 +05:30
Shinei Nouzen a8f1917ce7 feat: v2.2.0 — Modularize codebase, unify mirror fallback, harden security
Major Changes:
- Add shared parseListItem.helper.js for unified list parsing (DRY)
- Migrate all 22 extractors to use fetchWithMirror() for consistent mirror fallback
- Remove unused cors dependency (custom CORS middleware handles it)
- Fix middleware ordering: timeout now registered before routes
- Fix CORS to allow POST for /api/mirrors/reset endpoint
- Remove redundant cache check in homeInfo extractor

New Features:
- Request ID tracking (X-Request-Id header) for debugging
- Graceful shutdown handling (SIGTERM/SIGINT) with 10s timeout
- CSP and HSTS security headers
- Rate limiter cleanup interval (every 5 min) to prevent memory leak
- Request body size limits (10kb) via express.json()

Security:
- Content-Security-Policy header for XSS protection
- Strict-Transport-Security for HTTPS enforcement
- X-Permitted-Cross-Domain-Policies: none
- Body size limits to prevent large payload attacks

Code Quality:
- All files follow strict documentation style (box headers, section separators,
  feature markers, JSDoc params/returns, inline notes, module footers)
- Eliminated ~200 lines of duplicated code across 8+ extractors
- Updated CHANGELOG.md with comprehensive change history
2026-07-28 19:28:21 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 100b9f9414 v1.9.0: Full diagnostic sweep - 42 issues fixed
Critical fixes (7):
- Added global Express error handler (returns JSON instead of HTML)
- Removed caching from random endpoint (defeated purpose)
- Renamed share.jpg to share.png (MIME type mismatch)
- Fixed OG image dimensions (630 → 601)
- Fixed manifest.json icon sizes (192x192 → 512x512)
- Fixed implicit global event variable in console
- Added 9 missing endpoints to docs/endpoints.md

High fixes (12):
- Imported version from package.json (no hardcoded drift)
- Added dynamic endpoint count in stats
- Added input sanitization for mapper API (SSRF prevention)
- Added homepage caching (reduced 5 duplicate HTTP requests)
- Added rate limiting (100 requests/minute per IP)
- Added rel="noopener noreferrer" to all target="_blank" links
- Fixed trailing slash inconsistency in console
- Added noindex meta to 404.html
- Fixed docs/architecture.md controller filenames and dependency versions
- Fixed README.md dependency versions
- Added 12 missing endpoint tests

Medium fixes (22):
- Added escapeHtml helper for error messages
- Consistent favicon across all pages
- Added meta descriptions to privacy.html and tos.html
- Added OG/Twitter meta tags to privacy.html and tos.html
- Added aria-label to playground inputs
- Added aria-hidden to decorative SVGs
- Synced Twitter description with OG description
- Fixed robots.txt to disallow /api
- Added PWA fields to manifest.json
- Removed 5 unused imports
- Removed unused cookie-parser dependency
- Fixed inconsistent error handling in extractors
- Fixed resolvedSlug returning numeric ID
- Added /watch endpoint to streaming docs
- Improved test assertions and status code validation
- Deleted orphaned og-image.svg and logo.png

Low fixes (11):
- Removed redundant try/catch from extractPages
- Added max size eviction to cache
- Added cache key sorting in filter controller
- Added author meta tag
- Fixed favicon.svg font

Version bumped to 1.9.0
2026-06-09 06:00:37 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ e0e348682f fix: streaming endpoints - parse JSON responses, extract server HTML
- episodeList: Parse AJAX JSON response, extract server_ids/timestamp/mal_id
- streamInfo: Parse server list HTML into structured server objects
- streamInfo: Parse stream URL from JSON response properly
- Added cheerio import to streamInfo extractor
- Servers now return: type, link_id, cmid, sv_id, ep_id, name
2026-06-08 20:51:05 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ b1eb899aa9 v1.7.0: Rebrand AniKatoAPI → AniKotoAPI
BREAKING: Complete project rebrand across 66 files
- AniKatoAPI → AniKotoAPI (project name)
- AniKato → AniKoto (brand references)
- anikato.vercel.app → anikoto.vercel.app (URLs)
- anikototv.to preserved (source website domain)
- Updated: README, package.json, server.js, all controllers,
  extractors, configs, routes, public pages, legal docs
2026-06-08 19:41:00 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 0034617c3b v1.5.0: Complete documentation rewrite - 50+ files with AlisaReactionBot style
- Box-style header comments (Project, Author, License) on every file
- Section headers using double-line box decorators
- Feature markers (// ---- FEATURE: XYZ ----) before every major function
- JSDoc comments for EVERY function with @param, @returns, @example
- Inline notes (NOTE, WARNING, TIP) for non-obvious logic
- Footer END markers on every module
- Matched code style to AlisaReactionBot repository
- All files now searchable by feature name via grep

Author: Shinei Nouzen <157171073+Shineii86@users.noreply.github.com>
2026-06-08 16:14:01 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 8e201ccb10 feat: complete streaming and AJAX endpoint support
- Add stream URL extraction via /ajax/server?get={linkId}
- Add mapper API integration for gogoanime/anivibe servers
- Add /api/seasons/:id endpoint
- Add /api/watch-order/:id endpoint
- Add /api/episodes-ajax/:id endpoint
- Add /api/servers endpoint
- Add genre/type/status/rating ID mappings
- Fix filter to use correct numeric IDs
- Fix watch page data attribute extraction
2026-06-08 15:44:30 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 1906ba4a34 fix: update extractors to match actual anikototv.to structure
- Analyzed actual HTML structure of anikototv.to
- Updated all extractors with correct CSS selectors
- Changed ID-based to slug-based lookups
- Updated URL patterns to match actual website
- Fixed stream info to use AJAX server list
- Improved error handling
2026-06-08 15:18:27 +05:30
Sʜɪɴᴇɪ Nᴏᴜᴢᴇɴ 3815521b0d feat: initial project setup for AniKatoAPI
- Express.js server with Vercel deployment support
- Complete API endpoints for anikototv.to anime data
- Home, search, info, episodes, stream, schedule endpoints
- Category filtering and genre support
- Caching system with 5-minute TTL
- CORS configuration
- Public documentation page
- Docker and Render deployment configs
- MIT License
2026-06-08 15:08:22 +05:30