// ==UserScript== // @name Youtube shorts redirect // @namespace ViolentMonkey Scripts // @version 0.3 // @match *://*.youtube.com/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; const replaceShortsLinks = () => { [...document.querySelectorAll('a[href*="/shorts/"]')] .forEach(a => { a.href = a.href.replace(/\/shorts\/(.*)/, '/watch?v=$1') }); }; window.addEventListener("yt-navigate-finish", replaceShortsLinks, true); let oldHref = document.location.href; if (window.location.href.indexOf('youtube.com/shorts') > -1) { window.location.replace(window.location.toString().replace('/shorts/', '/watch?v=')); } function shortsRedirector() { if (oldHref != document.location.href) { oldHref = document.location.href; if (window.location.href.indexOf('youtube.com/shorts') > -1) { window.location.replace(window.location.toString().replace('/shorts/', '/watch?v=')); } } } window.addEventListener("yt-navigate-finish", shortsRedirector, true); })();