mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-14 03:14:54 +00:00
Update streambox.ts
This commit is contained in:
parent
e00e9e1b8a
commit
c8d803934d
1 changed files with 51 additions and 41 deletions
|
|
@ -17,16 +17,10 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
throw new NotFoundError('Failed to fetch StreamBox data');
|
||||
}
|
||||
|
||||
console.log(apiRes);
|
||||
|
||||
const data = await apiRes;
|
||||
|
||||
if (data.provider !== 'MovieBox') {
|
||||
throw new NotFoundError('Not a MovieBox provider response');
|
||||
}
|
||||
|
||||
if (!data.url || data.url.length === 0) {
|
||||
throw new NotFoundError('No MovieBox streams found');
|
||||
}
|
||||
|
||||
const streams: Record<string, string> = {};
|
||||
data.url.forEach((stream: any) => {
|
||||
streams[stream.resulation] = stream.link;
|
||||
|
|
@ -39,46 +33,62 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
type: 'srt',
|
||||
}));
|
||||
|
||||
if (data.provider === 'MovieBox') {
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
captions,
|
||||
qualities: {
|
||||
...(streams['1080'] && {
|
||||
1080: {
|
||||
type: 'mp4',
|
||||
url: streams['1080'],
|
||||
},
|
||||
}),
|
||||
...(streams['720'] && {
|
||||
720: {
|
||||
type: 'mp4',
|
||||
url: streams['720'],
|
||||
},
|
||||
}),
|
||||
...(streams['480'] && {
|
||||
480: {
|
||||
type: 'mp4',
|
||||
url: streams['480'],
|
||||
},
|
||||
}),
|
||||
...(streams['360'] && {
|
||||
360: {
|
||||
type: 'mp4',
|
||||
url: streams['360'],
|
||||
},
|
||||
}),
|
||||
},
|
||||
type: 'file',
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
preferredHeaders: {
|
||||
Referer: data.headers?.Referer,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const hlsStream = data.url.find((stream: any) => stream.type === 'hls') || data.url[0];
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
{
|
||||
id: 'primary',
|
||||
captions,
|
||||
qualities: {
|
||||
...(streams['1080'] && {
|
||||
1080: {
|
||||
type: 'mp4',
|
||||
url: streams['1080'],
|
||||
},
|
||||
}),
|
||||
...(streams['720'] && {
|
||||
720: {
|
||||
type: 'mp4',
|
||||
url: streams['720'],
|
||||
},
|
||||
}),
|
||||
...(streams['480'] && {
|
||||
480: {
|
||||
type: 'mp4',
|
||||
url: streams['480'],
|
||||
},
|
||||
}),
|
||||
...(streams['360'] && {
|
||||
360: {
|
||||
type: 'mp4',
|
||||
url: streams['360'],
|
||||
},
|
||||
}),
|
||||
},
|
||||
type: 'file',
|
||||
playlist: hlsStream.link,
|
||||
type: 'hls',
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
...(data.proxy && {
|
||||
preferredHeaders: {
|
||||
Referer: 'https://h5.aoneroom.com',
|
||||
},
|
||||
proxyDepth: 1,
|
||||
}),
|
||||
preferredHeaders: {
|
||||
Referer: data.headers?.Referer,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue