diff --git a/src/providers/all.ts b/src/providers/all.ts index e9f7c1d..159c496 100644 --- a/src/providers/all.ts +++ b/src/providers/all.ts @@ -1,10 +1,11 @@ import { Embed, Sourcerer } from '@/providers/base'; import { upcloudScraper } from '@/providers/embeds/upcloud'; import { flixhqScraper } from '@/providers/sources/flixhq/index'; +import { remotreamScraper } from '@/providers/sources/remotestream/index'; export function gatherAllSources(): Array { // all sources are gathered here - return [flixhqScraper]; + return [flixhqScraper, remotreamScraper]; } export function gatherAllEmbeds(): Array { diff --git a/src/providers/sources/remotestream/index.ts b/src/providers/sources/remotestream/index.ts index b7601c5..4027a31 100644 --- a/src/providers/sources/remotestream/index.ts +++ b/src/providers/sources/remotestream/index.ts @@ -5,22 +5,34 @@ import { NotFoundError } from '@/utils/errors'; import { remotestreamBase } from './common'; // TODO tv shows are available in flixHQ, just no scraper yet -export const flixhqScraper = makeSourcerer({ +export const remotreamScraper = makeSourcerer({ id: 'remotestream', name: 'Remote Stream', rank: 55, flags: [flags.NO_CORS], async scrapeShow(ctx) { - let playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}`; - const seasonNumber = ctx.media.season.number; const episodeNumber = ctx.media.episode.number; - playlistLink += `/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`; + const playlistLink = `${remotestreamBase}/Shows/${ctx.media.tmdbId}/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`; + + const streamRes = await ctx.fetcher(playlistLink); + if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found'); + + return { + embeds: [], + stream: { + playlist: playlistLink, + type: 'hls', + flags: [flags.NO_CORS], + }, + }; + }, + async scrapeMovie(ctx) { + const playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}/${ctx.media.tmdbId}.m3u8`; const streamRes = await ctx.fetcher(playlistLink); if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found'); - ctx.progress(90); return { embeds: [],