From 2f02522ca6376c511c640d5304dc7fc6f02413ed Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 2 Dec 2023 00:51:41 +0100 Subject: [PATCH 1/8] 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) => { From 50c3166e707bf52656d88fd185c546ae22c67634 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 2 Dec 2023 01:08:31 +0100 Subject: [PATCH 2/8] Fix script caching on upcloud --- src/providers/embeds/upcloud.ts | 7 ++++++- src/providers/sources/flixhq/index.ts | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/providers/embeds/upcloud.ts b/src/providers/embeds/upcloud.ts index 96cd14c..d31cf72 100644 --- a/src/providers/embeds/upcloud.ts +++ b/src/providers/embeds/upcloud.ts @@ -74,7 +74,12 @@ export const upcloudScraper = makeEmbed({ let sources: { file: string; type: string } | null = null; if (!isJSON(streamRes.sources)) { - const scriptJs = await ctx.proxiedFetcher(`https://rabbitstream.net/js/player/prod/e4-player.min.js`); + const scriptJs = await ctx.proxiedFetcher(`https://rabbitstream.net/js/player/prod/e4-player.min.js`, { + query: { + // browser side caching on this endpoint is quite extreme. Add version query paramter to circumvent any caching + v: Date.now().toString(), + }, + }); const decryptionKey = extractKey(scriptJs); if (!decryptionKey) throw new Error('Key extraction failed'); diff --git a/src/providers/sources/flixhq/index.ts b/src/providers/sources/flixhq/index.ts index e5cae5b..90fe251 100644 --- a/src/providers/sources/flixhq/index.ts +++ b/src/providers/sources/flixhq/index.ts @@ -5,7 +5,6 @@ import { getFlixhqMovieSources, getFlixhqShowSources, getFlixhqSourceDetails } f import { getFlixhqId } from '@/providers/sources/flixhq/search'; import { NotFoundError } from '@/utils/errors'; -// TODO tv shows are available in flixHQ, just no scraper yet export const flixhqScraper = makeSourcerer({ id: 'flixhq', name: 'FlixHQ', From a2c0a7045fcf6f0dd5e392dc30a9194f93333770 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sat, 2 Dec 2023 01:11:18 +0100 Subject: [PATCH 3/8] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 50e8c39..8658a05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@movie-web/providers", - "version": "1.1.2", + "version": "1.1.3", "description": "Package that contains all the providers of movie-web", "main": "./lib/index.umd.js", "types": "./lib/index.d.ts", From c59cc8807711a072db8064ff62dbc1d7d20b4701 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 00:07:26 +0000 Subject: [PATCH 4/8] Bump vite from 4.5.0 to 4.5.1 in /.docs Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.5.1/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.1/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: indirect ... Signed-off-by: dependabot[bot] --- .docs/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.docs/package-lock.json b/.docs/package-lock.json index e894486..810205e 100644 --- a/.docs/package-lock.json +++ b/.docs/package-lock.json @@ -17286,9 +17286,9 @@ "dev": true }, "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz", + "integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==", "dev": true, "dependencies": { "esbuild": "^0.18.10", From eb14d8d069ccaddfa66e3a0e7db6a64d9f336a93 Mon Sep 17 00:00:00 2001 From: elpaxel <45597512+elpaxel@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:01:25 +0200 Subject: [PATCH 5/8] Superstream captions fix --- src/providers/sources/superstream/common.ts | 4 ++++ src/providers/sources/superstream/subtitles.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/providers/sources/superstream/common.ts b/src/providers/sources/superstream/common.ts index b5d5de1..99299a2 100644 --- a/src/providers/sources/superstream/common.ts +++ b/src/providers/sources/superstream/common.ts @@ -11,3 +11,7 @@ export const apiUrls = [ ]; export const appKey = atob('bW92aWVib3g='); export const appId = atob('Y29tLnRkby5zaG93Ym94'); +export const captionsDomains = [ + atob('bWJwaW1hZ2VzLmNodWF4aW4uY29t'), + atob('aW1hZ2VzLnNoZWd1Lm5ldA=='), +]; \ No newline at end of file diff --git a/src/providers/sources/superstream/subtitles.ts b/src/providers/sources/superstream/subtitles.ts index 08fba3f..05346cd 100644 --- a/src/providers/sources/superstream/subtitles.ts +++ b/src/providers/sources/superstream/subtitles.ts @@ -2,6 +2,8 @@ import { Caption, getCaptionTypeFromUrl, isValidLanguageCode } from '@/providers import { sendRequest } from '@/providers/sources/superstream/sendRequest'; import { ScrapeContext } from '@/utils/context'; +import { captionsDomains } from './common'; + interface CaptionApiResponse { data: { list: { @@ -40,7 +42,10 @@ export async function getSubtitles( subtitleList.forEach((sub) => { const subtitle = sub.subtitles.sort((a, b) => b.order - a.order)[0]; if (!subtitle) return; - const subtitleType = getCaptionTypeFromUrl(subtitle.file_path); + const subtitleFilePath = subtitle.file_path.replace(captionsDomains[0], captionsDomains[1]).replace(/\s/g, "+").replace(/[()]/g, (c) => { + return "%" + c.charCodeAt(0).toString(16); + }); + const subtitleType = getCaptionTypeFromUrl(subtitleFilePath); if (!subtitleType) return; const validCode = isValidLanguageCode(subtitle.lang); @@ -50,7 +55,7 @@ export async function getSubtitles( language: subtitle.lang, hasCorsRestrictions: true, type: subtitleType, - url: subtitle.file_path, + url: subtitleFilePath, }); }); From 44f33182027939d6bb798c9884492172e6385b3d Mon Sep 17 00:00:00 2001 From: elpaxel <45597512+elpaxel@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:20:15 +0200 Subject: [PATCH 6/8] Quotes fix --- src/providers/sources/superstream/subtitles.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/providers/sources/superstream/subtitles.ts b/src/providers/sources/superstream/subtitles.ts index 05346cd..9eef467 100644 --- a/src/providers/sources/superstream/subtitles.ts +++ b/src/providers/sources/superstream/subtitles.ts @@ -42,8 +42,8 @@ export async function getSubtitles( subtitleList.forEach((sub) => { const subtitle = sub.subtitles.sort((a, b) => b.order - a.order)[0]; if (!subtitle) return; - const subtitleFilePath = subtitle.file_path.replace(captionsDomains[0], captionsDomains[1]).replace(/\s/g, "+").replace(/[()]/g, (c) => { - return "%" + c.charCodeAt(0).toString(16); + const subtitleFilePath = subtitle.file_path.replace(captionsDomains[0], captionsDomains[1]).replace(/\s/g, '+').replace(/[()]/g, (c) => { + return '%' + c.charCodeAt(0).toString(16); }); const subtitleType = getCaptionTypeFromUrl(subtitleFilePath); if (!subtitleType) return; From 4dc71793287c82d7fc2a1215e5f126ab40f42a87 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Thu, 7 Dec 2023 14:22:26 +0100 Subject: [PATCH 7/8] Fix linting --- src/providers/sources/superstream/common.ts | 5 +---- src/providers/sources/superstream/subtitles.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/providers/sources/superstream/common.ts b/src/providers/sources/superstream/common.ts index 99299a2..6ad1448 100644 --- a/src/providers/sources/superstream/common.ts +++ b/src/providers/sources/superstream/common.ts @@ -11,7 +11,4 @@ export const apiUrls = [ ]; export const appKey = atob('bW92aWVib3g='); export const appId = atob('Y29tLnRkby5zaG93Ym94'); -export const captionsDomains = [ - atob('bWJwaW1hZ2VzLmNodWF4aW4uY29t'), - atob('aW1hZ2VzLnNoZWd1Lm5ldA=='), -]; \ No newline at end of file +export const captionsDomains = [atob('bWJwaW1hZ2VzLmNodWF4aW4uY29t'), atob('aW1hZ2VzLnNoZWd1Lm5ldA==')]; diff --git a/src/providers/sources/superstream/subtitles.ts b/src/providers/sources/superstream/subtitles.ts index 9eef467..36be8de 100644 --- a/src/providers/sources/superstream/subtitles.ts +++ b/src/providers/sources/superstream/subtitles.ts @@ -42,9 +42,12 @@ export async function getSubtitles( subtitleList.forEach((sub) => { const subtitle = sub.subtitles.sort((a, b) => b.order - a.order)[0]; if (!subtitle) return; - const subtitleFilePath = subtitle.file_path.replace(captionsDomains[0], captionsDomains[1]).replace(/\s/g, '+').replace(/[()]/g, (c) => { - return '%' + c.charCodeAt(0).toString(16); - }); + const subtitleFilePath = subtitle.file_path + .replace(captionsDomains[0], captionsDomains[1]) + .replace(/\s/g, '+') + .replace(/[()]/g, (c) => { + return `%${c.charCodeAt(0).toString(16)}`; + }); const subtitleType = getCaptionTypeFromUrl(subtitleFilePath); if (!subtitleType) return; From 34164933ebf9cf298172a774310f99f8cbb25850 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Thu, 7 Dec 2023 14:28:26 +0100 Subject: [PATCH 8/8] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8658a05..e70858e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@movie-web/providers", - "version": "1.1.3", + "version": "1.1.4", "description": "Package that contains all the providers of movie-web", "main": "./lib/index.umd.js", "types": "./lib/index.d.ts",