From 2f02522ca6376c511c640d5304dc7fc6f02413ed Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 2 Dec 2023 00:51:41 +0100 Subject: [PATCH] Better error handling for superstream --- src/providers/sources/superstream/index.ts | 2 ++ src/providers/sources/superstream/subtitles.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/providers/sources/superstream/index.ts b/src/providers/sources/superstream/index.ts index 8e78167..173f849 100644 --- a/src/providers/sources/superstream/index.ts +++ b/src/providers/sources/superstream/index.ts @@ -43,6 +43,7 @@ export const superStreamScraper = makeSourcerer({ }; const { qualities, fid } = await getStreamQualities(ctx, apiQuery); + if (fid === undefined) throw new NotFoundError('No streamable file found'); return { embeds: [], @@ -90,6 +91,7 @@ export const superStreamScraper = makeSourcerer({ }; const { qualities, fid } = await getStreamQualities(ctx, apiQuery); + if (fid === undefined) throw new NotFoundError('No streamable file found'); return { embeds: [], diff --git a/src/providers/sources/superstream/subtitles.ts b/src/providers/sources/superstream/subtitles.ts index 6516dfc..08fba3f 100644 --- a/src/providers/sources/superstream/subtitles.ts +++ b/src/providers/sources/superstream/subtitles.ts @@ -31,10 +31,10 @@ export async function getSubtitles( tid: type !== 'movie' ? id : undefined, episode: episodeId?.toString(), season: seasonId?.toString(), - group: episodeId ? '' : undefined, }; - const subtitleList = ((await sendRequest(ctx, subtitleApiQuery)) as CaptionApiResponse).data.list; + const subResult = (await sendRequest(ctx, subtitleApiQuery)) as CaptionApiResponse; + const subtitleList = subResult.data.list; const output: Caption[] = []; subtitleList.forEach((sub) => {