mirror of
https://github.com/p-stream/providers.git
synced 2026-05-11 22:50:54 +00:00
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { flags } from '@/entrypoint/utils/targets';
|
|
import { makeSourcerer } from '@/providers/base';
|
|
import { NotFoundError } from '@/utils/errors';
|
|
|
|
const remotestreamBase = `https://fsa.remotestre.am`;
|
|
|
|
export const remotestreamScraper = makeSourcerer({
|
|
id: 'remotestream',
|
|
name: 'Remote Stream',
|
|
rank: 55,
|
|
flags: [flags.CORS_ALLOWED],
|
|
async scrapeShow(ctx) {
|
|
const seasonNumber = ctx.media.season.number;
|
|
const episodeNumber = ctx.media.episode.number;
|
|
|
|
const playlistLink = `${remotestreamBase}/Shows/${ctx.media.tmdbId}/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`;
|
|
|
|
ctx.progress(30);
|
|
const streamRes = await ctx.fetcher<Blob>(playlistLink); // TODO support blobs in fetchers
|
|
if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found');
|
|
ctx.progress(90);
|
|
|
|
return {
|
|
embeds: [],
|
|
stream: [
|
|
{
|
|
id: 'primary',
|
|
captions: [],
|
|
playlist: playlistLink,
|
|
type: 'hls',
|
|
flags: [flags.CORS_ALLOWED],
|
|
},
|
|
],
|
|
};
|
|
},
|
|
async scrapeMovie(ctx) {
|
|
const playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}/${ctx.media.tmdbId}.m3u8`;
|
|
|
|
ctx.progress(30);
|
|
const streamRes = await ctx.fetcher<Blob>(playlistLink);
|
|
if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found');
|
|
ctx.progress(90);
|
|
|
|
return {
|
|
embeds: [],
|
|
stream: [
|
|
{
|
|
id: 'primary',
|
|
captions: [],
|
|
playlist: playlistLink,
|
|
type: 'hls',
|
|
flags: [flags.CORS_ALLOWED],
|
|
},
|
|
],
|
|
};
|
|
},
|
|
});
|