Youtube fix share url

Remove tracking parametr "si" from video link from share button

< Feedback on Youtube fix share url

Review: Good - script works

§
Posted: 12. 03. 2024

Dope! I modified it a little to not run on a timer. Go ahead and mod your script if you'd like so I can take mine down! :)
Please leave credit tho!


// ==UserScript==
// @name Youtube fix share url
// @namespace http://tampermonkey.net/
// @version 1
// @description Remove tracking parameter "si" from video link from share button
// @author SergoZar
// @match https://www.youtube.com/watch*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @license GPLv3
// @downloadURL https://update.greasyfork.org/scripts/489533/Youtube%20fix%20share%20url.user.js
// @updateURL https://update.greasyfork.org/scripts/489533/Youtube%20fix%20share%20url.meta.js
// ==/UserScript==

(function() {
'use strict';

function fix_url(){
var share_url = document.getElementById("share-url");
if(share_url){
var url = new URL(share_url.value);
url.searchParams.delete("si");
share_url.value = url.toString();
}
}

var observer = new MutationObserver(fix_url);
observer.observe(document.documentElement, { subtree: true, childList: true });

// Initial fix
fix_url();
})();

§
Posted: 12. 03. 2024

mb that code is wrong
this one functions


(function() {
'use strict';

function fix_url(){
var share_url = document.getElementById("share-url");
if(share_url){
var url = new URL(share_url.value);
url.searchParams.delete("si");
share_url.value = url.toString();
}
}

var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === "attributes" && mutation.attributeName === "aria-checked") {
fix_url();
}
});
});

observer.observe(document.body, { subtree: true, attributes: true });

})();

§
Posted: 12. 03. 2024

The code tags are ass so here is a pastebin.

SergoZarAuthor
§
Posted: 04. 04. 2024

After several hours of trying to use your code variation, I was unable to fix the problem where the attribute is not removed after changing the time in the video. Maybe the MutationObserver doesn't see changes in the value attribute when the video time changes.

However, I added your code as one of the versions so you might want to install it if it works well for you:
https://greasyfork.org/uk/scripts/489533-youtube-fix-share-url?version=1354329

Post reply

Sign in to post a reply.