Created
February 7, 2025 17:39
-
-
Save abraxas86/9ee9f9028619d3480c73b6dc5b2df7e4 to your computer and use it in GitHub Desktop.
This is a Tampermonkey script that detects when a YouTube Shorts link is opened and flips it over to Watch link so it presents itself as a proper video. The shorts layout is absolute garbage that nobody should use - it's bad enough people create these videos in the first place...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name YouTube Shorts Fixer | |
// @namespace https://gist.github.com/abraxas86 | |
// @version 1.2 | |
// @description Replace "/shorts/" with "/watch/" because shorts format is hot garbage that nobody should tolerate | |
// @author me | |
// @match *://*.youtube.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Function to modify the URL | |
function modifyUrl() { | |
if (window.location.href.includes('/shorts/')) { | |
// Disconnect the observer to stop further modifications | |
observer.disconnect(); | |
window.location.href = window.location.href.replace('/shorts/', '/watch?v='); | |
} | |
} | |
// Observe changes in the URL | |
const observer = new MutationObserver(modifyUrl); | |
observer.observe(document, { subtree: true, childList: true }); | |
// Run the function to modify the URL initially | |
modifyUrl(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment