// ==UserScript== // @name Redirect from shorts page // @namespace Violentmonkey Scripts // @match https://www.youtube.com/* // @grant none // @version 1.0 // @author emyfemy // @description Redirects you away from any youtube shorts URL to the actual watch page // ==/UserScript== let oldHref = document.location.href; let redirectShorts = () => { let currentUrl = window.location.href; if(currentUrl.includes('shorts/')) { let newUrl = currentUrl.replace('shorts/', 'watch?v='); window.location.replace(newUrl); } }; window.onload = function() { redirectShorts(); let bodyList = document.querySelector('body') let observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if(oldHref != document.location.href) { oldHref = document.location.href; redirectShorts(); } }); }); let config = { childList: true, subtree: true }; observer.observe(bodyList, config); };