Greasy Fork is available in English.

YouTube Shorts Redirect

Redirect YouTube shorts to default player

  1. // ==UserScript==
  2. // @name YouTube Shorts Redirect
  3. // @namespace https://github.com/bennett-zhang
  4. // @version 0.1
  5. // @description Redirect YouTube shorts to default player
  6. // @author Bennett Zhang
  7. // @match *://*.youtube.com/*
  8. // @icon https://raw.githubusercontent.com/bennett-zhang/youtube-shorts-redirect/main/src/icons/icon32.png
  9. // @icon64 https://raw.githubusercontent.com/bennett-zhang/youtube-shorts-redirect/main/src/icons/icon64.png
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. function redirect(url) {
  15. if (url.includes("shorts/")) {
  16. window.location.replace(url.replace("shorts/", "watch?v="));
  17. }
  18. }
  19.  
  20. // Desktop YouTube
  21. window.addEventListener("yt-navigate-start", evt => {
  22. redirect(evt.target.baseURI);
  23. });
  24.  
  25. // Mobile YouTube
  26. window.addEventListener("state-navigatestart", evt => {
  27. redirect(evt.detail.href);
  28. });
  29.  
  30. redirect(window.location.href);
  31. })();