mirror of
https://gitlab.com/vyla-entertainment/sdk.git
synced 2026-11-21 01:25:42 -05:00
removed vidora, and bcine. fixed vidlink
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
import { fetchText } from '../utils/helpers.js';
|
||||
|
||||
export async function getStream({ id, s, e }) {
|
||||
const isTv = s != null && e != null;
|
||||
const url = isTv
|
||||
? `https://vidora-3l2w.onrender.com/api/sources?type=tv&id=${id}&season=${s}&episode=${e}`
|
||||
: `https://vidora-3l2w.onrender.com/api/sources?type=movie&id=${id}`;
|
||||
|
||||
const headers = {
|
||||
'Accept': 'text/event-stream',
|
||||
'Referer': 'https://vidora-3l2w.onrender.com/',
|
||||
'Origin': 'https://vidora-3l2w.onrender.com',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36'
|
||||
};
|
||||
|
||||
const raw = await fetchText(url, { headers }).catch(() => null);
|
||||
if (!raw) return null;
|
||||
|
||||
const lines = raw.split('\n');
|
||||
let doneSources = null;
|
||||
const streamItems = [];
|
||||
|
||||
for (const line of lines) {
|
||||
const trimmed = line.trim();
|
||||
if (!trimmed.startsWith('{') || !trimmed.endsWith('}')) continue;
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(trimmed);
|
||||
if (parsed.event === 'source' && parsed.source?.url) {
|
||||
streamItems.push(parsed.source);
|
||||
} else if (parsed.event === 'done' && Array.isArray(parsed.sources)) {
|
||||
doneSources = parsed.sources;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
const targetList = (doneSources && doneSources.length > 0) ? doneSources : streamItems;
|
||||
if (!targetList.length) return null;
|
||||
|
||||
const allUrls = [];
|
||||
|
||||
for (const src of targetList) {
|
||||
if (!src.url || !src.url.startsWith('http')) continue;
|
||||
|
||||
allUrls.push({
|
||||
url: src.url,
|
||||
server: `Vidora - ${src.label || src.server || src.providerGroup || 'Server'} (${src.quality || 'Auto'})`,
|
||||
headers: src.headers || {
|
||||
Referer: 'https://vidora-3l2w.onrender.com/',
|
||||
Origin: 'https://vidora-3l2w.onrender.com'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!allUrls.length) return null;
|
||||
|
||||
return {
|
||||
url: allUrls[0].url,
|
||||
headers: allUrls[0].headers,
|
||||
allUrls
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user