From 943fe7991ea8057135529d610c4ab86705328920 Mon Sep 17 00:00:00 2001 From: Aholicknight Date: Mon, 25 Nov 2024 18:55:58 -0600 Subject: [PATCH] api/facebook: handle URLs with query parameters in share links --- api/src/processing/services/facebook.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/src/processing/services/facebook.js b/api/src/processing/services/facebook.js index 7bfd4751e..adab20233 100644 --- a/api/src/processing/services/facebook.js +++ b/api/src/processing/services/facebook.js @@ -29,6 +29,12 @@ export default async function({ id, shareType, shortLink }) { if (shareType) url = `https://web.facebook.com/share/${shareType}/${id}`; if (shortLink) url = await resolveUrl(`https://fb.watch/${shortLink}`); + // Handle URLs with query parameters like ?mibextid + if (url.includes('?')) { + const urlObj = new URL(url); + url = urlObj.origin + urlObj.pathname; + } + const html = await fetch(url, { headers }) .then(r => r.text()) .catch(() => false); @@ -54,4 +60,4 @@ export default async function({ id, shareType, shortLink }) { filename: `${baseFilename}.mp4`, audioFilename: `${baseFilename}_audio`, }; -} +} \ No newline at end of file