Update aniliberty/aniliberty.js

This commit is contained in:
aka paul 2025-10-12 22:08:11 +00:00
parent 8037ecaab6
commit 21dd90f44d

View file

@ -1,12 +1,11 @@
// AniLiberty module for Sora (AsyncJS)
// Author: emp0ry
// Version: 1.0.3
// Changes: add skip markers (opening/ending) and average_duration_of_episode -> "Duration: Xm".
// Version: 1.0.1
const IMAGE_HOST = "https://anilibria.top";
function fullImg(path) {
if (!path) return `${IMAGE_HOST}/favicon.ico`;
if (!path) return;
return path.startsWith("http") ? path : `${IMAGE_HOST}${path}`;
}
@ -47,7 +46,6 @@ async function searchResults(keyword) {
const out = (Array.isArray(data) ? data : []).map(it => ({
title: it?.name?.main || "Unknown title",
image: fullImg(it?.poster?.src),
// Pass a details endpoint as href (will be reused by details/episodes)
href:
`${base}anime/releases/${it.id}?` +
[
@ -61,16 +59,11 @@ async function searchResults(keyword) {
}));
if (!out.length) {
out.push({
title: "No results from AniLiberty",
image: `${IMAGE_HOST}/favicon.ico`,
href: IMAGE_HOST
});
return JSON.stringify([]);;
}
return JSON.stringify(out);
} catch (e) {
console.log("AniLiberty search error:", e);
return JSON.stringify([{ title: "Error", image: `${IMAGE_HOST}/favicon.ico`, href: IMAGE_HOST }]);
return JSON.stringify([]);;
}
}
@ -94,12 +87,7 @@ async function extractDetails(url) {
}];
return JSON.stringify(out);
} catch (e) {
console.log("AniLiberty details error:", e);
return JSON.stringify([{
description: "Error loading details",
aliases: "Duration: Unknown",
airdate: "Unknown"
}]);
return JSON.stringify([]);;
}
}
@ -151,7 +139,6 @@ async function extractEpisodes(url) {
return JSON.stringify(out);
} catch (e) {
console.log("AniLiberty episodes error:", e);
return JSON.stringify([]);
}
}
@ -163,7 +150,6 @@ async function extractStreamUrl(url) {
try {
return url; // direct HLS
} catch (e) {
console.log("AniLiberty stream error:", e);
return null;
}
}
}