forked from 50n50/sources
Update streamingunity/streamingunity.js
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
|
async function getLandingWebsiteHref() {
|
||||||
|
var response = await fetch("https://previtera.vercel.app/");
|
||||||
|
var href = await response.text();
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
|
||||||
async function searchResults(keyword) {
|
async function searchResults(keyword) {
|
||||||
|
const landingUrl = await getLandingWebsiteHref()
|
||||||
|
|
||||||
const response = await soraFetch(
|
const response = await soraFetch(
|
||||||
`https://streamingcommunityz.kitchen/it/archive?search=${keyword}`
|
`https://${landingUrl}/it/archive?search=${keyword}`
|
||||||
);
|
);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
@@ -20,12 +28,11 @@ async function searchResults(keyword) {
|
|||||||
.map((item) => {
|
.map((item) => {
|
||||||
const posterImage = item.images?.find((img) => img.type === "poster");
|
const posterImage = item.images?.find((img) => img.type === "poster");
|
||||||
return {
|
return {
|
||||||
title:
|
title: item.name?.replaceAll("amp;", "").replaceAll("'", "'") || "",
|
||||||
item.name?.replaceAll("amp;", "").replaceAll("'", "'") || "",
|
image: posterImage?.filename ?
|
||||||
image: posterImage?.filename
|
`https://cdn.${landingUrl}/images/${posterImage.filename}` :
|
||||||
? `https://cdn.streamingcommunityz.kitchen/images/${posterImage.filename}`
|
"",
|
||||||
: "",
|
href: `https://${landingUrl}/it/titles/${item.id}-${item.slug}`,
|
||||||
href: `https://streamingcommunityz.kitchen/it/titles/${item.id}-${item.slug}`,
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter((item) => item.image) || [];
|
.filter((item) => item.image) || [];
|
||||||
@@ -34,6 +41,8 @@ async function searchResults(keyword) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function extractDetails(url) {
|
async function extractDetails(url) {
|
||||||
|
const baseUrl = await getLandingWebsiteHref()
|
||||||
|
|
||||||
const response = await soraFetch(`${url}/season-1`);
|
const response = await soraFetch(`${url}/season-1`);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
@@ -52,22 +61,20 @@ async function extractDetails(url) {
|
|||||||
return JSON.stringify([]);
|
return JSON.stringify([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JSON.stringify([
|
return JSON.stringify([{
|
||||||
{
|
description: titleData.plot?.replaceAll("amp;", "").replaceAll("'", "'") ||
|
||||||
description:
|
|
||||||
titleData.plot?.replaceAll("amp;", "").replaceAll("'", "'") ||
|
|
||||||
"N/A",
|
"N/A",
|
||||||
aliases:
|
aliases: titleData.original_name
|
||||||
titleData.original_name
|
|
||||||
?.replaceAll("amp;", "")
|
?.replaceAll("amp;", "")
|
||||||
.replaceAll("'", "'") || "N/A",
|
.replaceAll("'", "'") || "N/A",
|
||||||
airdate: titleData.release_date || "N/A",
|
airdate: titleData.release_date || "N/A",
|
||||||
},
|
}, ]);
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function extractEpisodes(url) {
|
async function extractEpisodes(url) {
|
||||||
try {
|
try {
|
||||||
|
const landingUrl = await getLandingWebsiteHref()
|
||||||
|
|
||||||
const episodes = [];
|
const episodes = [];
|
||||||
const baseUrl = url.replace(/\/season-\d+$/, "");
|
const baseUrl = url.replace(/\/season-\d+$/, "");
|
||||||
|
|
||||||
@@ -103,7 +110,7 @@ async function extractEpisodes(url) {
|
|||||||
hasEpisodes = true;
|
hasEpisodes = true;
|
||||||
seasonEpisodes.forEach((episode) => {
|
seasonEpisodes.forEach((episode) => {
|
||||||
episodes.push({
|
episodes.push({
|
||||||
href: `https://streamingcommunityz.kitchen/it/iframe/${titleId}?episode_id=${episode.id}`,
|
href: `https://${landingUrl}/it/iframe/${titleId}?episode_id=${episode.id}`,
|
||||||
number: episode.number || episodes.length + 1,
|
number: episode.number || episodes.length + 1,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -116,7 +123,7 @@ async function extractEpisodes(url) {
|
|||||||
|
|
||||||
if (!hasEpisodes) {
|
if (!hasEpisodes) {
|
||||||
episodes.push({
|
episodes.push({
|
||||||
href: `https://streamingcommunityz.kitchen/it/iframe/${titleId}`,
|
href: `https://${landingUrl}/it/iframe/${titleId}`,
|
||||||
number: 1,
|
number: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -218,7 +225,11 @@ async function extractStreamUrl(url) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function soraFetch(url, options = { headers: {}, method: 'GET', body: null }) {
|
async function soraFetch(url, options = {
|
||||||
|
headers: {},
|
||||||
|
method: 'GET',
|
||||||
|
body: null
|
||||||
|
}) {
|
||||||
try {
|
try {
|
||||||
return await fetchv2(url, options.headers ?? {}, options.method ?? 'GET', options.body ?? null);
|
return await fetchv2(url, options.headers ?? {}, options.method ?? 'GET', options.body ?? null);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user