🚫 ShortsOff! - YouTube Shorts Remover

Disables elements that lead to YouTube Shorts.

  1. // ==UserScript==
  2. // @name 🚫 ShortsOff! - YouTube Shorts Remover
  3. // @icon https://solabs.neocities.org/assets/no_shorts!.png
  4. // @license GNU GPL v3.0; http://www.gnu.org/licenses/gpl-3.0.txt
  5. // @match https://www.youtube.com/*
  6. // @version 1.1
  7. // @author Boon!
  8. // @description Disables elements that lead to YouTube Shorts.
  9. // @namespace https://gf.qytechs.cn/users/1398226
  10. // ==/UserScript==
  11.  
  12. console.log("[ShortsOff!] Boop!")
  13.  
  14. // Remove shorts category when searching.
  15. function removeShortsSearchCategory() {
  16. const elements = document.querySelectorAll('yt-formatted-string[title="Shorts"]');
  17. elements.forEach(element => {
  18. if (element) {
  19. element.parentElement.remove();
  20. }
  21. });
  22. }
  23.  
  24. // Removes the shorts endpoint link at the sidebar.
  25. function removeShortsEndpointLinks() {
  26. const elements = document.querySelectorAll('a[title="Shorts"]');
  27. elements.forEach(element => {
  28. if (element) {
  29. element.remove();
  30. }
  31. });
  32. }
  33.  
  34. // Removes the recommended shorts at the homepage.
  35. function removeIsShorts() {
  36. const elements = document.querySelectorAll('[is-shorts]');
  37. elements.forEach(element => {
  38. if (element) {
  39. element.remove();
  40. }
  41. });
  42. }
  43.  
  44. // Removes the recommended shorts at the side while watching a video.
  45. function removeYtdReels() {
  46. const elements = document.querySelectorAll('ytd-reel-shelf-renderer');
  47. elements.forEach(element => {
  48. if (element) {
  49. element.remove();
  50. } });
  51. }
  52.  
  53. // Main function
  54. function main() {
  55. removeShortsEndpointLinks();
  56. removeIsShorts();
  57. removeYtdReels();
  58. removeShortsSearchCategory()
  59. }
  60.  
  61. // Initialize an observer that runs the main function when an element is modified.
  62. const observer = new MutationObserver(main);
  63. observer.observe(document.body, { childList: true, subtree: true });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址