From 77540229a077a46c9a06b274a99221799126bb29 Mon Sep 17 00:00:00 2001 From: Jorrin Date: Mon, 1 Apr 2024 00:13:04 +0200 Subject: [PATCH 1/3] Update valid.ts --- src/utils/valid.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/valid.ts b/src/utils/valid.ts index 65db1ea..86f17e8 100644 --- a/src/utils/valid.ts +++ b/src/utils/valid.ts @@ -22,26 +22,26 @@ export async function validatePlayableStream( stream: Stream, ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions, ): Promise { - const fetcher = stream.flags.length === 1 && stream.flags.includes('cors-allowed') ? ops.fetcher : ops.proxiedFetcher; if (stream.type === 'hls') { - const headResult = await fetcher.full(stream.playlist, { - method: 'HEAD', + const result = await ops.proxiedFetcher.full(stream.playlist, { + method: 'GET', headers: { ...stream.preferredHeaders, ...stream.headers, }, }); - if (headResult.statusCode !== 200) return null; + if (result.statusCode !== 200) return null; return stream; } if (stream.type === 'file') { const validQualitiesResults = await Promise.all( Object.values(stream.qualities).map((quality) => - fetcher.full(quality.url, { - method: 'HEAD', + ops.proxiedFetcher.full(quality.url, { + method: 'GET', headers: { ...stream.preferredHeaders, ...stream.headers, + Range: 'bytes=0-1', }, }), ), @@ -49,7 +49,7 @@ export async function validatePlayableStream( // remove invalid qualities from the stream const validQualities = stream.qualities; Object.keys(stream.qualities).forEach((quality, index) => { - if (validQualitiesResults[index].statusCode !== 200) { + if (validQualitiesResults[index].statusCode < 200 || validQualitiesResults[index].statusCode >= 400) { delete validQualities[quality as keyof typeof stream.qualities]; } }); From 090c892bda02e6a4bb8cfff547cd73dadd8784e0 Mon Sep 17 00:00:00 2001 From: Jorrin Date: Mon, 1 Apr 2024 00:18:42 +0200 Subject: [PATCH 2/3] woops we also need that check here --- src/utils/valid.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/valid.ts b/src/utils/valid.ts index 86f17e8..fb9ef0f 100644 --- a/src/utils/valid.ts +++ b/src/utils/valid.ts @@ -30,7 +30,7 @@ export async function validatePlayableStream( ...stream.headers, }, }); - if (result.statusCode !== 200) return null; + if (result.statusCode < 200 || result.statusCode >= 400) return null; return stream; } if (stream.type === 'file') { From 9119c0675ed92ecf750577252cca702ee6bca517 Mon Sep 17 00:00:00 2001 From: Jorrin Date: Mon, 1 Apr 2024 00:27:10 +0200 Subject: [PATCH 3/3] bump version and changelog --- .docs/content/1.get-started/4.changelog.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.docs/content/1.get-started/4.changelog.md b/.docs/content/1.get-started/4.changelog.md index 19f78f7..ea72f5e 100644 --- a/.docs/content/1.get-started/4.changelog.md +++ b/.docs/content/1.get-started/4.changelog.md @@ -2,6 +2,9 @@ title: 'Changelog' --- +# Version 2.2.7 +- Fix showbox + # Version 2.2.6 - Fix febbox - Validate if a stream is actually playable. Streams that are not responding are no longer returned. diff --git a/package.json b/package.json index 8438d0b..d9111f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@movie-web/providers", - "version": "2.2.6", + "version": "2.2.7", "description": "Package that contains all the providers of movie-web", "type": "module", "main": "./lib/index.umd.js",