From 6f108443e3c432b72737aec36c16cdebda059a7e Mon Sep 17 00:00:00 2001 From: cloud <62519659+lem6ns@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:02:13 -0700 Subject: [PATCH] Fix for TV and check if path exists. --- src/providers/list/superstream/index.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/providers/list/superstream/index.ts b/src/providers/list/superstream/index.ts index 34605303..9d1bb77d 100644 --- a/src/providers/list/superstream/index.ts +++ b/src/providers/list/superstream/index.ts @@ -174,10 +174,12 @@ export const superStreamScraper: MWMediaProvider = { }; const mediaRes = (await get(apiQuery).then((r) => r.json())).data; const hdQuality = - mediaRes.list.find((quality: any) => quality.quality === "1080p") ?? - mediaRes.list.find((quality: any) => quality.quality === "720p") ?? - mediaRes.list.find((quality: any) => quality.quality === "480p") ?? - mediaRes.list.find((quality: any) => quality.quality === "360p"); + mediaRes.list.find((quality: any) => (quality.quality === "1080p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "720p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "480p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "360p" && quality.path)); + + if (!hdQuality) throw new Error("No quality could be found."); const subtitleApiQuery = { fid: hdQuality.fid, @@ -215,8 +217,12 @@ export const superStreamScraper: MWMediaProvider = { }; const mediaRes = (await get(apiQuery).then((r) => r.json())).data; const hdQuality = - mediaRes.list.find((quality: any) => quality.quality === "1080p") ?? - mediaRes.list.find((quality: any) => quality.quality === "720p"); + mediaRes.list.find((quality: any) => (quality.quality === "1080p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "720p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "480p" && quality.path)) ?? + mediaRes.list.find((quality: any) => (quality.quality === "360p" && quality.path)); + + if (!hdQuality) throw new Error("No quality could be found."); const subtitleApiQuery = { fid: hdQuality.fid,