From 985b8d244d47533a4946764b808efef93b173b46 Mon Sep 17 00:00:00 2001 From: Stefan Cruz <17972991+stefancruz@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:02:03 +0100 Subject: [PATCH] fix: remove fallback client id and secret --- build/DailymotionScript.js | 10 +--------- src/constants.ts | 4 ---- src/extraction.ts | 9 +-------- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/build/DailymotionScript.js b/build/DailymotionScript.js index a93c62e..5793e61 100644 --- a/build/DailymotionScript.js +++ b/build/DailymotionScript.js @@ -17,9 +17,6 @@ const REGEX_VIDEO_PLAYLIST_URL = /^https:\/\/(?:www\.)?dailymotion\.com\/playlis const REGEX_INITIAL_DATA_API_AUTH_1 = /(?<=window\.__LOADABLE_LOADED_CHUNKS__=.*)\b[a-f0-9]{20}\b|\b[a-f0-9]{40}\b/g; const createAuthRegexByTextLength = (length) => new RegExp(`\\b\\w+\\s*=\\s*"([a-zA-Z0-9]{${length}})"`); const USER_AGENT = 'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.230 Mobile Safari/537.36'; -// Those are used even for not logged users to make requests on the graphql api. -const FALLBACK_CLIENT_ID = 'f1a362d288c1b98099c7'; -const FALLBACK_CLIENT_SECRET = 'eea605b96e01c796ff369935357eca920c5da4c5'; const FALLBACK_SPOT_ID = 'sp_vWPN1lBu'; const PLATFORM = 'Dailymotion'; const PLATFORM_CLAIMTYPE = 27; @@ -1396,12 +1393,7 @@ function extractClientCredentials(httpClient) { if (!detailsRequestHtml.isOk) { throw new ScriptException('Failed to fetch page to extract auth details'); } - const result = [ - { - clientId: FALLBACK_CLIENT_ID, - secret: FALLBACK_CLIENT_SECRET, - }, - ]; + const result = []; const match = detailsRequestHtml.body.match(REGEX_INITIAL_DATA_API_AUTH_1); if (match?.length === 2 && match[0] && match[1]) { result.unshift({ diff --git a/src/constants.ts b/src/constants.ts index 4ed25c0..c4715f3 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -43,11 +43,7 @@ export const createAuthRegexByTextLength = (length: number) => export const USER_AGENT = 'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.230 Mobile Safari/537.36'; -// Those are used even for not logged users to make requests on the graphql api. -export const FALLBACK_CLIENT_ID = 'f1a362d288c1b98099c7'; -export const FALLBACK_CLIENT_SECRET = 'eea605b96e01c796ff369935357eca920c5da4c5'; export const FALLBACK_SPOT_ID = 'sp_vWPN1lBu'; - export const PLATFORM = 'Dailymotion'; export const PLATFORM_CLAIMTYPE = 27; diff --git a/src/extraction.ts b/src/extraction.ts index 14f221d..68c1af9 100644 --- a/src/extraction.ts +++ b/src/extraction.ts @@ -3,8 +3,6 @@ import { BASE_URL, BASE_URL_API_AUTH, createAuthRegexByTextLength, - FALLBACK_CLIENT_ID, - FALLBACK_CLIENT_SECRET, REGEX_INITIAL_DATA_API_AUTH_1, USER_AGENT, } from './constants'; @@ -65,12 +63,7 @@ export function extractClientCredentials(httpClient: IHttp) { throw new ScriptException('Failed to fetch page to extract auth details'); } - const result = [ - { - clientId: FALLBACK_CLIENT_ID, - secret: FALLBACK_CLIENT_SECRET, - }, - ]; + const result = []; const match = detailsRequestHtml.body.match(REGEX_INITIAL_DATA_API_AUTH_1); -- GitLab