feat(providers): support remotestream movies

This commit is contained in:
2023-09-11 22:48:33 -05:00
parent ebb7af7123
commit 6fc1a74729
2 changed files with 19 additions and 6 deletions

View File

@@ -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<Sourcerer> {
// all sources are gathered here
return [flixhqScraper];
return [flixhqScraper, remotreamScraper];
}
export function gatherAllEmbeds(): Array<Embed> {

View File

@@ -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<Blob>(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<Blob>(playlistLink);
if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found');
ctx.progress(90);
return {
embeds: [],