mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-09 08:27:33 +00:00
add streambox
This commit is contained in:
parent
dda3870926
commit
7afa76ad3d
2 changed files with 87 additions and 0 deletions
|
|
@ -55,6 +55,7 @@ import { iosmirrorPVScraper } from './sources/iosmirrorpv';
|
|||
import { ridooMoviesScraper } from './sources/ridomovies';
|
||||
import { slidemoviesScraper } from './sources/slidemovies';
|
||||
import { soaperTvScraper } from './sources/soapertv';
|
||||
import { streamboxScraper } from './sources/streambox';
|
||||
import { uiraliveScraper } from './sources/uiralive';
|
||||
import { vidapiClickScraper } from './sources/vidapiclick';
|
||||
import { warezcdnScraper } from './sources/warezcdn';
|
||||
|
|
@ -85,6 +86,7 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||
uiraliveScraper,
|
||||
vidapiClickScraper,
|
||||
coitusScraper,
|
||||
streamboxScraper,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
85
src/providers/sources/streambox.ts
Normal file
85
src/providers/sources/streambox.ts
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/* eslint-disable no-console */
|
||||
import { flags } from '@/entrypoint/utils/targets';
|
||||
import { SourcererOutput, makeSourcerer } from '@/providers/base';
|
||||
import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||
import { NotFoundError } from '@/utils/errors';
|
||||
|
||||
const streamboxBase = 'https://vidjoy.pro/embed/api/fastfetch';
|
||||
|
||||
async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> {
|
||||
const apiRes = await ctx.proxiedFetcher(
|
||||
ctx.media.type === 'movie'
|
||||
? `${streamboxBase}/${ctx.media.tmdbId}?sr=0`
|
||||
: `${streamboxBase}/${ctx.media.tmdbId}/${ctx.media.season.number}/${ctx.media.episode.number}?sr=0`,
|
||||
);
|
||||
|
||||
if (!apiRes) {
|
||||
throw new NotFoundError('Failed to fetch StreamBox data');
|
||||
}
|
||||
const data = await apiRes;
|
||||
|
||||
const streams: Record<string, string> = {};
|
||||
data.url.forEach((stream: any) => {
|
||||
streams[stream.resulation] = stream.link;
|
||||
});
|
||||
|
||||
const captions = data.tracks.map((track: any) => ({
|
||||
id: track.lang,
|
||||
url: track.url,
|
||||
language: track.code,
|
||||
type: 'srt',
|
||||
}));
|
||||
|
||||
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],
|
||||
...(data.proxy && {
|
||||
preferredHeaders: {
|
||||
Referer: 'https://h5.aoneroom.com',
|
||||
},
|
||||
proxyDepth: 1,
|
||||
}),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const streamboxScraper = makeSourcerer({
|
||||
id: 'streambox',
|
||||
name: 'StreamBox',
|
||||
rank: 231,
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
scrapeMovie: comboScraper,
|
||||
scrapeShow: comboScraper,
|
||||
});
|
||||
Loading…
Reference in a new issue