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