mirror of
https://github.com/Shineii86/AniKotoAPI.git
synced 2026-10-22 10:55:10 +00:00
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
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import * as cheerio from "cheerio";
|
||||
import axios from "axios";
|
||||
import { headers } from "../configs/header.config.js";
|
||||
import { URLS } from "../configs/dataUrl.js";
|
||||
|
||||
const extractSchedule = async (date) => {
|
||||
try {
|
||||
const url = URLS.schedule(date);
|
||||
const { data } = await axios.get(url, { headers });
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const schedule = [];
|
||||
$(".schedule-item, .anime-schedule .item").each((i, el) => {
|
||||
const id = $(el).find("a").attr("href")?.split("/").pop() || "";
|
||||
const title = $(el).find(".film-name a, .dynamic-name").text().trim() || "";
|
||||
const japaneseTitle = $(el).find(".fd-infor .fdi-item:first-child").text().trim() || "";
|
||||
const time = $(el).find(".time, .schedule-time").text().trim() || "";
|
||||
const episodeNo = parseInt($(el).find(".episode-no, .ep-num").text().trim()) || 0;
|
||||
const releaseDate = $(el).find(".date, .release-date").text().trim() || "";
|
||||
|
||||
if (id) {
|
||||
schedule.push({
|
||||
id,
|
||||
title,
|
||||
japaneseTitle,
|
||||
time,
|
||||
episode_no: episodeNo,
|
||||
releaseDate
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return schedule;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export { extractSchedule };
|
||||
Reference in New Issue
Block a user