Skip to content

Instantly share code, notes, and snippets.

@Fooftilly
Created August 8, 2023 14:42
Show Gist options
  • Save Fooftilly/08d41aef2dd410f65e99b95b7878f4c8 to your computer and use it in GitHub Desktop.
Save Fooftilly/08d41aef2dd410f65e99b95b7878f4c8 to your computer and use it in GitHub Desktop.
Remove tracking from Spotify links when pasting them
// ==UserScript==
// @name Remove Spotify si parameter
// @version 1.0
// @description Automatically remove the si parameter from Spotify links when pasting them
// @match *://*/*
// @author ChatGPT
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('paste', function(e) {
var text = e.clipboardData.getData('text');
if (text.includes('open.spotify.com')) {
var url = new URL(text);
url.searchParams.delete('si');
e.preventDefault();
document.execCommand('insertText', false, url.toString());
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment