From d49c4081975f9dd0d5b6d86c9ac77bcc97966523 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Fri, 5 Jan 2024 19:36:26 +0100 Subject: [PATCH] Fix remotestream for real --- src/providers/sources/remotestream.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/providers/sources/remotestream.ts b/src/providers/sources/remotestream.ts index d358899..8a3090b 100644 --- a/src/providers/sources/remotestream.ts +++ b/src/providers/sources/remotestream.ts @@ -16,8 +16,12 @@ export const remotestreamScraper = makeSourcerer({ const playlistLink = `${remotestreamBase}/Shows/${ctx.media.tmdbId}/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`; ctx.progress(30); - const streamRes = await ctx.fetcher(playlistLink); // TODO support blobs in fetchers - if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found'); + const streamRes = await ctx.fetcher.full(playlistLink, { + method: 'HEAD', + readHeaders: ['content-type'], + }); + if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl')) + throw new NotFoundError('No watchable item found'); ctx.progress(90); return { @@ -37,8 +41,12 @@ export const remotestreamScraper = makeSourcerer({ const playlistLink = `${remotestreamBase}/Movies/${ctx.media.tmdbId}/${ctx.media.tmdbId}.m3u8`; ctx.progress(30); - const streamRes = await ctx.fetcher(playlistLink); - if (streamRes.type !== 'application/x-mpegurl') throw new NotFoundError('No watchable item found'); + const streamRes = await ctx.fetcher.full(playlistLink, { + method: 'HEAD', + readHeaders: ['content-type'], + }); + if (!streamRes.headers.get('content-type')?.toLowerCase().includes('application/x-mpegurl')) + throw new NotFoundError('No watchable item found'); ctx.progress(90); return {