NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Invidiousize
// @description Replace YouTube links with links to an Invidious instance.
// @author jaidedctrl
// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @match *://*
// @run-at document-end
// ==/UserScript==
var invInstance = "https://invidious.snopyta.org";
var url = window.location.href;
if ( url.match("youtube.com") == null ) {
var links = document.querySelectorAll( "a" );
for ( var i = 0; i < links.length; i++ ) {
var href = links[i].getAttribute( "href" );
if ( href.match( "youtube.com" ) != null ) {
href = href.replace( /.*youtube.com/, invInstance );
links[i].setAttribute( "href", href );
}
}
}