fix: correct AniSkip API query parameters

This commit is contained in:
paregi12 2026-01-04 11:58:54 +05:30
parent 3de2fb4809
commit 0919a40c75

View file

@ -50,7 +50,12 @@ async function getMalIdFromKitsu(kitsuId: string): Promise<string | null> {
async function fetchFromAniSkip(malId: string, episode: number): Promise<SkipInterval[]> {
try {
// Fetch OP, ED, and Recap
const url = `${ANISKIP_API_URL}/skip-times/${malId}/${episode}?types[]=op&types[]=ed&types[]=recap&types[]=mixed-op&types[]=mixed-ed`;
// AniSkip expects repeated 'types' parameters without brackets: ?types=op&types=ed...
// episodeLength=0 is required for validation
const types = ['op', 'ed', 'recap', 'mixed-op', 'mixed-ed'];
const queryParams = types.map(t => `types=${t}`).join('&');
const url = `${ANISKIP_API_URL}/skip-times/${malId}/${episode}?${queryParams}&episodeLength=0`;
const response = await axios.get(url);
if (response.data.found && response.data.results) {