From 28f253c5420495f8a43386f29c72d4915bfe2dce Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 16 Aug 2023 19:26:29 +0200 Subject: [PATCH 1/6] Remove faster cdn, as its broken --- src/backend/providers/superstream/index.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/backend/providers/superstream/index.ts b/src/backend/providers/superstream/index.ts index 883d1ad5..7111473e 100644 --- a/src/backend/providers/superstream/index.ts +++ b/src/backend/providers/superstream/index.ts @@ -18,12 +18,6 @@ import { compareTitle } from "@/utils/titleMatch"; const nanoid = customAlphabet("0123456789abcdef", 32); -function makeFasterUrl(url: string) { - const fasterUrl = new URL(url); - fasterUrl.host = "mp4.shegu.net"; // this domain is faster - return fasterUrl.toString(); -} - const qualityMap = { "360p": MWStreamQuality.Q360P, "480p": MWStreamQuality.Q480P, @@ -205,7 +199,7 @@ registerProvider({ return { embeds: [], stream: { - streamUrl: makeFasterUrl(hdQuality.path), + streamUrl: hdQuality.path, quality: qualityMap[hdQuality.quality as QualityInMap], type: MWStreamType.MP4, captions: mappedCaptions, @@ -261,7 +255,7 @@ registerProvider({ quality: qualityMap[ hdQuality.quality as QualityInMap ] as MWStreamQuality, - streamUrl: makeFasterUrl(hdQuality.path), + streamUrl: hdQuality.path, type: MWStreamType.MP4, captions: mappedCaptions, }, From 8c105e78b5bde54515b28ce42d1554ba2bd763de Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 16 Aug 2023 19:26:43 +0200 Subject: [PATCH 2/6] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05a36350..40cb440c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "3.2.0", + "version": "3.2.1", "private": true, "homepage": "https://movie-web.app", "dependencies": { From 53fe6031d131fea2325d880a3f1e4b115dc40035 Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Wed, 1 Nov 2023 15:04:52 +0100 Subject: [PATCH 3/6] Fix superstream --- package.json | 2 +- src/backend/providers/superstream/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 40cb440c..a0764f31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "3.2.1", + "version": "3.2.2", "private": true, "homepage": "https://movie-web.app", "dependencies": { diff --git a/src/backend/providers/superstream/index.ts b/src/backend/providers/superstream/index.ts index 7111473e..1ab8a36d 100644 --- a/src/backend/providers/superstream/index.ts +++ b/src/backend/providers/superstream/index.ts @@ -148,13 +148,13 @@ registerProvider({ async scrape({ media, episode, progress }) { // Find Superstream ID for show const searchQuery = { - module: "Search3", + module: "Search4", page: "1", type: "all", keyword: media.meta.title, pagelimit: "20", }; - const searchRes = (await get(searchQuery, true)).data; + const searchRes = (await get(searchQuery, true)).data.list; progress(33); const superstreamEntry = searchRes.find( From bb449d6dfb1b8064c910ce28a0f942ccde8af2e2 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Tue, 7 Nov 2023 21:04:43 +0100 Subject: [PATCH 4/6] Fix upcloud --- src/backend/embeds/upcloud.ts | 60 +++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/src/backend/embeds/upcloud.ts b/src/backend/embeds/upcloud.ts index 4bac2b94..be1228f5 100644 --- a/src/backend/embeds/upcloud.ts +++ b/src/backend/embeds/upcloud.ts @@ -29,6 +29,32 @@ function isJSON(json: string) { } } +function extractKey(script: string): [number, number][] | null { + const startOfSwitch = script.lastIndexOf("switch"); + const endOfCases = script.indexOf("partKeyStartPosition"); + const switchBody = script.slice(startOfSwitch, endOfCases); + + const nums: [number, number][] = []; + const matches = switchBody.matchAll( + /:[a-zA-Z0-9]+=([a-zA-Z0-9]+),[a-zA-Z0-9]+=([a-zA-Z0-9]+);/g + ); + for (const match of matches) { + const innerNumbers: number[] = []; + for (const varMatch of [match[1], match[2]]) { + const regex = new RegExp(`${varMatch}=0x([a-zA-Z0-9]+)`, "g"); + const varMatches = [...script.matchAll(regex)]; + const lastMatch = varMatches[varMatches.length - 1]; + if (!lastMatch) return null; + const number = parseInt(lastMatch[1], 16); + innerNumbers.push(number); + } + + nums.push([innerNumbers[0], innerNumbers[1]]); + } + + return nums; +} + registerEmbedScraper({ id: "upcloud", displayName: "UpCloud", @@ -54,23 +80,31 @@ registerEmbedScraper({ let sources: { file: string; type: string } | null = null; if (!isJSON(streamRes.sources)) { - const decryptionKey = JSON.parse( - await proxiedFetch( - `https://raw.githubusercontent.com/enimax-anime/key/e4/key.txt` - ) - ) as [number, number][]; + const scriptJs = await proxiedFetch( + `https://rabbitstream.net/js/player/prod/e4-player.min.js`, + { + responseType: "text" as any, + } + ); + const decryptionKey = extractKey(scriptJs); + if (!decryptionKey) throw new Error("Key extraction failed"); let extractedKey = ""; - const sourcesArray = streamRes.sources.split(""); - for (const index of decryptionKey) { - for (let i: number = index[0]; i < index[1]; i += 1) { - extractedKey += streamRes.sources[i]; - sourcesArray[i] = ""; - } - } + let strippedSources = streamRes.sources; + let totalledOffset = 0; + decryptionKey.forEach(([a, b]) => { + const start = a + totalledOffset; + const end = start + b; + extractedKey += streamRes.sources.slice(start, end); + strippedSources = strippedSources.replace( + streamRes.sources.substring(start, end), + "" + ); + totalledOffset += b; + }); const decryptedStream = AES.decrypt( - sourcesArray.join(""), + strippedSources, extractedKey ).toString(enc.Utf8); const parsedStream = JSON.parse(decryptedStream)[0]; From fde5f0c82edb35bffe7e436cb5ab3349c650fb60 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Tue, 7 Nov 2023 21:07:39 +0100 Subject: [PATCH 5/6] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a0764f31..ca0077ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "3.2.2", + "version": "3.2.3", "private": true, "homepage": "https://movie-web.app", "dependencies": { From 2c92bbf94ebc763bf7b7b8919813d279623a66dd Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Thu, 9 Nov 2023 15:34:35 +0100 Subject: [PATCH 6/6] Fix poster issue --- package.json | 2 +- src/components/media/MediaCard.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ca0077ae..11e6eaea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "3.2.3", + "version": "3.2.4", "private": true, "homepage": "https://movie-web.app", "dependencies": { diff --git a/src/components/media/MediaCard.tsx b/src/components/media/MediaCard.tsx index 707c4fe4..9e127e35 100644 --- a/src/components/media/MediaCard.tsx +++ b/src/components/media/MediaCard.tsx @@ -51,7 +51,7 @@ function MediaCardContent({ >