YouTube Redirect Shorts

Redirects youtube shorts to the normal player

  1. // ==UserScript==
  2. // @name YouTube Redirect Shorts
  3. // @namespace https://github.com/sapondanaisriwan/youtube-anti-shorts
  4. // @match https://www.youtube.com/*
  5. // @grant none
  6. // @version 1.0.2
  7. // @author sapondanaisriwan
  8. // @description Redirects youtube shorts to the normal player
  9. // @license MIT
  10. // @run-at document-start
  11. // @icon https://i.imgur.com/I9uDrsq.png
  12. // @homepageURL https://github.com/sapondanaisriwan/youtube-anti-shorts
  13. // @supportURL https://github.com/sapondanaisriwan/youtube-anti-shorts/issues
  14. // ==/UserScript==
  15. /*
  16. If you want to submit a bug or request a feature please report via github issue. Since I receive so many emails, I can't reply to them all.
  17. Contact: sapondanaisriwan@gmail.com
  18. Support me: https://ko-fi.com/sapondanaisriwan
  19. Support me: https://ko-fi.com/sapondanaisriwan
  20. Support me: https://ko-fi.com/sapondanaisriwan
  21. Support me: https://ko-fi.com/sapondanaisriwan
  22. Support me: https://ko-fi.com/sapondanaisriwan
  23. */
  24. "use strict";
  25. function redirectToWatchPage() {
  26. const { origin, pathname } = location;
  27. const isShorts = pathname.startsWith("/shorts/");
  28. const newURL = `${origin}${pathname.replace("shorts", "watch")}`;
  29. isShorts && location.replace(newURL);
  30. }
  31. function run() {
  32. redirectToWatchPage();
  33. document.addEventListener("yt-navigate-start", redirectToWatchPage);
  34. }
  35. run();