mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 19:05:11 +00:00
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>
This commit is contained in:
@@ -1,9 +1,43 @@
|
||||
/*
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
* AniKatoAPI — watchOrder.extractor.js
|
||||
* Repository: https://github.com/Shineii86/AniKatoAPI
|
||||
*
|
||||
* @description
|
||||
* Extracts watch order information for a specific anime via API.
|
||||
* Returns recommended viewing order from the internal API endpoint.
|
||||
*
|
||||
* @exports
|
||||
* extractWatchOrder
|
||||
*
|
||||
* @author Shinei Nouzen
|
||||
* @license MIT
|
||||
* ======= • ======= • ======= • ======= • =======• =======
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import { headers } from "../configs/header.config.js";
|
||||
import { BASE_URL } from "../configs/dataUrl.js";
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// WATCH ORDER API EXTRACTION
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
|
||||
// ---- FEATURE: Extract watch order data from internal API ----
|
||||
/**
|
||||
* Fetches watch order information for a specific anime from the internal API.
|
||||
* Returns an array of watch order objects or empty array on error.
|
||||
*
|
||||
* @param {string} animeId - The anime ID to fetch watch order for
|
||||
* @returns {Promise<Array<Object>>} Array of watch order objects or empty array
|
||||
*
|
||||
* @example
|
||||
* const watchOrder = await extractWatchOrder("12345");
|
||||
* console.log(watchOrder[0].title); // First anime in watch order
|
||||
*/
|
||||
const extractWatchOrder = async (animeId) => {
|
||||
try {
|
||||
// NOTE: This is an internal API endpoint requiring X-Requested-With header
|
||||
const url = `${BASE_URL}/api/watch-order/${animeId}`;
|
||||
const { data } = await axios.get(url, {
|
||||
headers: {
|
||||
@@ -14,8 +48,11 @@ const extractWatchOrder = async (animeId) => {
|
||||
|
||||
return data || [];
|
||||
} catch (error) {
|
||||
// NOTE: Return empty array on error to maintain consistent API
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export { extractWatchOrder };
|
||||
export { extractWatchOrder };
|
||||
|
||||
// ══════════════════════════════════════════════════════════════ END: watchOrder.extractor.js
|
||||
|
||||
Reference in New Issue
Block a user