mirror of
https://git.luna-app.eu/50n50/sources
synced 2026-01-12 17:38:37 +01:00
100 lines
No EOL
2.9 KiB
JavaScript
100 lines
No EOL
2.9 KiB
JavaScript
async function searchResults(keyword) {
|
|
const results = [];
|
|
const postData = `{"searchTerm":"${keyword}","page":1,"limit":100}`;
|
|
try {
|
|
const response = await fetchv2("https://senshi.live/anime/filter", { "Content-Type": "application/json", "Referer": "https://senshi.live/" }, "POST", postData);
|
|
const data = await response.json();
|
|
|
|
if (data.data && Array.isArray(data.data)) {
|
|
for (const item of data.data) {
|
|
results.push({
|
|
title: item.title,
|
|
image: "https://senshi.live" + item.anime_picture,
|
|
href: item.id
|
|
});
|
|
}
|
|
}
|
|
|
|
return JSON.stringify(results);
|
|
} catch (err) {
|
|
return JSON.stringify([{
|
|
title: "Error",
|
|
image: "Error",
|
|
href: "Error"
|
|
}]);
|
|
}
|
|
}
|
|
|
|
async function extractDetails(ID) {
|
|
try {
|
|
const response = await fetchv2("https://senshi.live/anime/" + ID);
|
|
const data = await response.json();
|
|
|
|
return JSON.stringify([{
|
|
description: data.ani_description,
|
|
aliases: data.synonyms,
|
|
airdate: data.created_at
|
|
}]);
|
|
} catch (err) {
|
|
return JSON.stringify([{
|
|
description: "Error",
|
|
aliases: "Error",
|
|
airdate: "Error"
|
|
}]);
|
|
}
|
|
}
|
|
|
|
async function extractEpisodes(ID) {
|
|
const results = [];
|
|
try {
|
|
const response = await fetchv2("https://senshi.live/episodes/" + ID, {"Referer": "https://senshi.live/"});
|
|
const data = await response.json();
|
|
|
|
if (Array.isArray(data)) {
|
|
for (const ep of data) {
|
|
results.push({
|
|
href: "https://senshi.live/episode-embeds/" + ep.mal_id + "/" + ep.ep_id,
|
|
number: ep.ep_id
|
|
});
|
|
}
|
|
}
|
|
|
|
return JSON.stringify(results);
|
|
} catch (err) {
|
|
return JSON.stringify([{
|
|
href: "Error",
|
|
number: "Error"
|
|
}]);
|
|
}
|
|
}
|
|
|
|
async function extractStreamUrl(url) {
|
|
try {
|
|
const response = await fetchv2(url, {"Referer": "https://senshi.live/"});
|
|
const data = await response.json();
|
|
|
|
const streams = [];
|
|
const count = {};
|
|
for (const item of data) {
|
|
const status = item.status;
|
|
if (!count[status]) count[status] = 0;
|
|
count[status]++;
|
|
const title = count[status] > 1 ? `${status} ${count[status]}` : status;
|
|
streams.push({
|
|
title: title,
|
|
streamUrl: item.url,
|
|
headers: { "Referer": "https://senshi.live/" }
|
|
});
|
|
}
|
|
|
|
return JSON.stringify({
|
|
streams: streams,
|
|
subtitle: ""
|
|
});
|
|
} catch (err) {
|
|
return JSON.stringify({
|
|
streams: [],
|
|
subtitle: ""
|
|
});
|
|
}
|
|
} |