From 3e4bf3771ebaa65c1cdf3686754f2e53c39d8492 Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Fri, 8 Sep 2023 11:20:36 -0400 Subject: [PATCH] Add clean support for Google Search links (#29) --- js/shared.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/shared.js b/js/shared.js index 91d9465..c639a99 100644 --- a/js/shared.js +++ b/js/shared.js @@ -19,7 +19,10 @@ function cleanLink(link, youtubeShortenEnabled = false, fixTwitterEnabled = fals } else if ((oldLink.host === 'href.li')) { // Fix for href.li links var hrefLink = oldLink.href.split('?')[1] - var oldLink = new URL(hrefLink) + oldLink = new URL(hrefLink) + } else if ((oldLink.host === 'www.google.com') && (oldLink.pathname === '/url') && (oldLink.searchParams.has('url'))) { + // Fix for redirect links from Google Search (#29) + oldLink = new URL(oldLink.searchParams.get('url')) } // Generate new link var newLink = new URL(oldLink.origin + oldLink.pathname)