As the title says,
I have been trying to redirect the youtube url with this code:
// ==UserScript==
// @run-at document-start
// @name youtube to nsfwyoutube
// @include https://www.youtube.com/*
// @exclude https://www.youtube.com
// @exclude https://www.youtube.com/feed*
// @exclude https://www.youtube.com/channel*
// @exclude https://www.youtube.com/results*
// @exclude https://www.youtube.com/c*
// @version 1
// @grant none
// ==/UserScript==
var oldUrlPath = window.location.host + "/" + window.location.pathname;
/*--- Test that ".compact" is at end of URL, excepting any "hashes"
or searches.
*/
if ( ("www.nsfwyoutube.com/watch") != oldUrlPath) {
var newURL = window.location.protocol + "//"
+ "www.nsfwyoutube.com"
+ "/watch"
+ window.location.search
+ window.location.hash
;
/*-- replace() puts the good page in the history instead of the
bad page.
*/
window.location.replace (newURL);
}
It doesn't seem to work when I start watching a video, i am not very good with code.
I am using firefox.