docs: Complete documentation overhaul with live API data + bug fixes

Documentation (5800+ lines total):
- endpoints.md: All 43 endpoints documented with real response examples,
  param tables, response patterns, common workflows, error formats
- streaming.md: Complete streaming workflow guide with HLS.js/Plyr/Video.js
  integration, M3U8 proxy explanation, error handling
- examples.md: Working code examples in cURL, JS fetch, Python requests,
  Node.js axios, HTML/JS player integration (2240 lines)
- architecture.md: Full project structure, request flow diagrams, caching
  strategy, mirror failover, security, deployment notes
- index.md: Overview with quick start, feature highlights, endpoint tables

Bug fixes:
- episodeList.extractor: Parse JSON response before Cheerio (was passing
  raw JSON string as HTML, causing escaped quotes in IDs)
- episodeListAjax.extractor: Same JSON parsing fix
- topAnimeRankings.controller: Fix JSDoc and default sort from top to day
  (actual values are day/week/month, not top/newest)
- apiRoutes.js: Fix OpenAPI spec sort description for top-rankings

Tests: 35/35 passing
This commit is contained in:
Shinei Nouzen
2026-07-30 08:28:51 +05:30
parent 996cead3b1
commit 8f423bf39c
9 changed files with 4436 additions and 816 deletions
@@ -5,7 +5,7 @@
*
* @description
* Controller for top anime rankings. Returns ranked anime list
* with support for top (all-time) and newest sort modes.
* with support for day, week, and month sort modes.
*
* @exports
* getTopAnimeRankings - Express route handler for GET /api/top-rankings
@@ -28,18 +28,18 @@ import { getCache, setCache, TTL } from "../helper/cache.helper.js";
* with support for top (all-time) and newest sort modes.
*
* @param {object} req - Express request object
* @param {string} [req.query.sort="top"] - Sort mode: "top" or "newest"
* @param {string} [req.query.sort="day"] - Sort mode: "day", "week", or "month"
* @param {object} res - Express response object
* @param {Function} next - Express next middleware function
* @returns {void} Sends JSON response with ranked anime list
*
* @example
* GET /api/top-rankings?sort=top
* GET /api/top-rankings?sort=day
* Response: { success: true, results: [{ rank: 1, title: "...", ... }] }
*/
const getTopAnimeRankings = async (req, res, next) => {
try {
const { sort = "top" } = req.query;
const { sort = "day" } = req.query;
const cacheKey = `top_rankings_${sort}`;
const cached = getCache(cacheKey);
if (cached) {