mirror of
https://gitlab.com/vyla-entertainment/sdk.git
synced 2026-11-20 00:57:30 -05:00
organized/fixed streams
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
import { fetchJson } from '../utils/helpers.js';
|
||||
|
||||
export async function getStream({ id, s, e }) {
|
||||
const BASE_URL = 'https://f.rivo.st';
|
||||
|
||||
export async function getStream(args) {
|
||||
const { id, s, e } = args || {};
|
||||
const isTv = s != null && e != null;
|
||||
const separator = isTv ? '&' : '?';
|
||||
const basePath = isTv
|
||||
? `https://f.rivo.st/api/source/tv/${id}?s=${s}&e=${e}`
|
||||
: `https://f.rivo.st/api/source/movie/${id}`;
|
||||
? `${BASE_URL}/api/source/tv/${id}?s=${s}&e=${e}`
|
||||
: `${BASE_URL}/api/source/movie/${id}`;
|
||||
|
||||
const headers = {
|
||||
'Accept': '*/*',
|
||||
'Referer': 'https://f.rivo.st/',
|
||||
'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'
|
||||
Accept: '*/*',
|
||||
Referer: `${BASE_URL}/`,
|
||||
'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 serverIndices = Array.from({ length: 26 }, (_, i) => i + 1);
|
||||
const delimiter = basePath.includes('?') ? '&' : '?';
|
||||
|
||||
const responses = await Promise.allSettled(
|
||||
serverIndices.map(serverNum =>
|
||||
fetchJson(`${basePath}&server=${serverNum}`, { headers })
|
||||
fetchJson(`${basePath}${delimiter}server=${serverNum}`, { headers })
|
||||
.catch(() => null)
|
||||
)
|
||||
);
|
||||
@@ -34,10 +37,12 @@ export async function getStream({ id, s, e }) {
|
||||
allUrls.push({
|
||||
url: src.url,
|
||||
server: `Rivo - ${data.server || src.subProvider || 'Server'}`,
|
||||
quality: src.quality || 'Auto',
|
||||
type: src.kind || (src.url.includes('.m3u8') ? 'hls' : 'mp4'),
|
||||
headers: {
|
||||
Referer: 'https://f.rivo.st/',
|
||||
Origin: 'https://f.rivo.st'
|
||||
}
|
||||
Referer: `${BASE_URL}/`,
|
||||
Origin: BASE_URL,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -49,6 +54,6 @@ export async function getStream({ id, s, e }) {
|
||||
return {
|
||||
url: allUrls[0].url,
|
||||
headers: allUrls[0].headers,
|
||||
allUrls
|
||||
allUrls,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user