Skip to content

Commit

Permalink
Add clean support for Google Search links (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
corbindavenport committed Sep 8, 2023
1 parent d2fa8f4 commit 3e4bf37
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3e4bf37

Please sign in to comment.