From b04e2bbde19f95b6aa72572f68a0ae8b19d8a6fd Mon Sep 17 00:00:00 2001 From: jj Date: Sat, 20 Dec 2025 12:28:02 +0000 Subject: [PATCH] api/twitter: strip "tag" param from video urls --- api/src/processing/services/twitter.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api/src/processing/services/twitter.js b/api/src/processing/services/twitter.js index 572bc2f0..463b0589 100644 --- a/api/src/processing/services/twitter.js +++ b/api/src/processing/services/twitter.js @@ -37,9 +37,19 @@ function needsFixing(media) { } function bestQuality(arr) { - return arr.filter(v => v.content_type === "video/mp4") + return stripVideoURL( + arr.filter(v => v.content_type === "video/mp4") .reduce((a, b) => Number(a?.bitrate) > Number(b?.bitrate) ? a : b) .url + ); +} + +function stripVideoURL(maybeUrl) { + if (maybeUrl) { + const url = new URL(maybeUrl); + url.searchParams.delete('tag'); + return url.toString(); + } } let _cachedToken;