mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-22 05:36:32 +01:00
Update aniliberty/aniliberty.js
This commit is contained in:
parent
8037ecaab6
commit
21dd90f44d
1 changed files with 6 additions and 20 deletions
|
|
@ -1,12 +1,11 @@
|
||||||
// AniLiberty module for Sora (AsyncJS)
|
// AniLiberty module for Sora (AsyncJS)
|
||||||
// Author: emp0ry
|
// Author: emp0ry
|
||||||
// Version: 1.0.3
|
// Version: 1.0.1
|
||||||
// Changes: add skip markers (opening/ending) and average_duration_of_episode -> "Duration: Xm".
|
|
||||||
|
|
||||||
const IMAGE_HOST = "https://anilibria.top";
|
const IMAGE_HOST = "https://anilibria.top";
|
||||||
|
|
||||||
function fullImg(path) {
|
function fullImg(path) {
|
||||||
if (!path) return `${IMAGE_HOST}/favicon.ico`;
|
if (!path) return;
|
||||||
return path.startsWith("http") ? path : `${IMAGE_HOST}${path}`;
|
return path.startsWith("http") ? path : `${IMAGE_HOST}${path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,7 +46,6 @@ async function searchResults(keyword) {
|
||||||
const out = (Array.isArray(data) ? data : []).map(it => ({
|
const out = (Array.isArray(data) ? data : []).map(it => ({
|
||||||
title: it?.name?.main || "Unknown title",
|
title: it?.name?.main || "Unknown title",
|
||||||
image: fullImg(it?.poster?.src),
|
image: fullImg(it?.poster?.src),
|
||||||
// Pass a details endpoint as href (will be reused by details/episodes)
|
|
||||||
href:
|
href:
|
||||||
`${base}anime/releases/${it.id}?` +
|
`${base}anime/releases/${it.id}?` +
|
||||||
[
|
[
|
||||||
|
|
@ -61,16 +59,11 @@ async function searchResults(keyword) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (!out.length) {
|
if (!out.length) {
|
||||||
out.push({
|
return JSON.stringify([]);;
|
||||||
title: "No results from AniLiberty",
|
|
||||||
image: `${IMAGE_HOST}/favicon.ico`,
|
|
||||||
href: IMAGE_HOST
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return JSON.stringify(out);
|
return JSON.stringify(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("AniLiberty search error:", e);
|
return JSON.stringify([]);;
|
||||||
return JSON.stringify([{ title: "Error", image: `${IMAGE_HOST}/favicon.ico`, href: IMAGE_HOST }]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,12 +87,7 @@ async function extractDetails(url) {
|
||||||
}];
|
}];
|
||||||
return JSON.stringify(out);
|
return JSON.stringify(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("AniLiberty details error:", e);
|
return JSON.stringify([]);;
|
||||||
return JSON.stringify([{
|
|
||||||
description: "Error loading details",
|
|
||||||
aliases: "Duration: Unknown",
|
|
||||||
airdate: "Unknown"
|
|
||||||
}]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +139,6 @@ async function extractEpisodes(url) {
|
||||||
|
|
||||||
return JSON.stringify(out);
|
return JSON.stringify(out);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("AniLiberty episodes error:", e);
|
|
||||||
return JSON.stringify([]);
|
return JSON.stringify([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -163,7 +150,6 @@ async function extractStreamUrl(url) {
|
||||||
try {
|
try {
|
||||||
return url; // direct HLS
|
return url; // direct HLS
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("AniLiberty stream error:", e);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue