mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +00:00
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:
@@ -61,7 +61,8 @@ const extractEpisodeList = async (slugOrId) => {
|
||||
headers: { "X-Requested-With": "XMLHttpRequest" }
|
||||
});
|
||||
|
||||
const ajaxHtml = typeof ajaxRaw === "string" ? ajaxRaw : (ajaxRaw?.result || "");
|
||||
const ajaxParsed = typeof ajaxRaw === "string" ? JSON.parse(ajaxRaw) : ajaxRaw;
|
||||
const ajaxHtml = ajaxParsed?.result || "";
|
||||
const $ep = cheerio.load(ajaxHtml);
|
||||
|
||||
const episodes = [];
|
||||
|
||||
@@ -55,7 +55,8 @@ const extractEpisodeListAjax = async (animeId, style = "", vrf = "") => {
|
||||
});
|
||||
|
||||
// NOTE: Response is JSON {status, result} where result is HTML
|
||||
const html = typeof raw === "string" ? raw : (raw?.result || "");
|
||||
const parsed = typeof raw === "string" ? JSON.parse(raw) : raw;
|
||||
const html = parsed?.result || "";
|
||||
const $ = cheerio.load(html);
|
||||
|
||||
// NOTE: Extract filter options (Sub/Dub, episode ranges)
|
||||
|
||||
Reference in New Issue
Block a user