Hide youtube #shorts

Remove youtube shorts from subscriptions (Only in grid view)

  1. // ==UserScript==
  2. // @name Hide youtube #shorts
  3. // @namespace https://gist.github.com/danieloliveira117/8d129abcc5d744890c9bd55f1c122472
  4. // @version 1.5
  5. // @description Remove youtube shorts from subscriptions (Only in grid view)
  6. // @author danieloliveira117
  7. // @match https://*.youtube.com/feed/subscriptions
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. function removeShorts() {
  15. document.querySelectorAll('ytd-rich-shelf-renderer[is-shorts]').forEach(t => {
  16. if (t) {
  17. const elem = t.closest('ytd-rich-section-renderer');
  18.  
  19. if (elem) {
  20. elem.remove();
  21. console.log('Removed shorts section');
  22. }
  23. }
  24. });
  25. }
  26.  
  27. const observer = new MutationObserver(removeShorts);
  28. observer.observe(document.querySelector('#page-manager'), { childList: true, subtree: true });
  29. })();