From e30f2ee457113e5dd9330b06027150c9a4a25397 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Sun, 17 Apr 2022 22:21:36 +0100 Subject: [PATCH] Limit stream types to mp4 or m3u8 for gomostream --- src/providers/list/gomostream/index.ts | 5 ++++- src/providers/types.ts | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/providers/list/gomostream/index.ts b/src/providers/list/gomostream/index.ts index ff23d5a6..79122c37 100644 --- a/src/providers/list/gomostream/index.ts +++ b/src/providers/list/gomostream/index.ts @@ -88,7 +88,10 @@ export const gomostreamScraper: MWMediaProvider = { const index = unpacked.findIndex((e) => e === '"'); const streamUrl = unpacked.slice(0, index).join(''); - return { url: streamUrl, type: streamUrl.split('.').at(-1) || "mp4", captions: [] }; + const streamType = streamUrl.split('.').at(-1); + if (streamType !== "mp4" && streamType !== "m3u8") throw new Error("Unsupported stream type"); + + return { url: streamUrl, type: streamType, captions: [] }; }, async getSeasonDataFromMedia(media: MWPortableMedia): Promise { diff --git a/src/providers/types.ts b/src/providers/types.ts index c150e7f7..4f3795e0 100644 --- a/src/providers/types.ts +++ b/src/providers/types.ts @@ -20,8 +20,7 @@ export interface MWMediaCaption { } export interface MWMediaStream { url: string; - // type: MWMediaStreamType; - type: string; + type: MWMediaStreamType; captions: MWMediaCaption[]; }