Last active
August 7, 2023 11:34
-
-
Save danieloliveira117/8d129abcc5d744890c9bd55f1c122472 to your computer and use it in GitHub Desktop.
Hide youtube shorts from subscription page
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 Hide youtube #shorts | |
// @namespace https://gist.github.com/danieloliveira117/8d129abcc5d744890c9bd55f1c122472 | |
// @version 1.5 | |
// @description Remove youtube shorts from subscriptions (Only in grid view) | |
// @author danieloliveira117 | |
// @match https://*.youtube.com/feed/subscriptions | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
function removeShorts() { | |
document.querySelectorAll('ytd-rich-shelf-renderer[is-shorts]').forEach(t => { | |
if (t) { | |
const elem = t.closest('ytd-rich-section-renderer'); | |
if (elem) { | |
elem.remove(); | |
console.log('Removed shorts section'); | |
} | |
} | |
}); | |
} | |
const observer = new MutationObserver(removeShorts); | |
observer.observe(document.querySelector('#page-manager'), { childList: true, subtree: true }); | |
})(); |
Hi @balintsipter, sorry for the delay I've just updated the script here and on greasyfork, apparently it doesn't update automatically
I want to start off by thanking you for a great script.
But there are still some content creators that doesn't label their Shorts properly which doesn't match them using the overlay-style attribute. However, many still adds the #shorts hashtag to the title so appending ,#video-title[title~="#shorts"]
to the querySelectorAll
string helped me get rid of them.
Just wanted to give my praise and share a minor improvement I made to my local script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @danieloliveira117 I found the script on greasyfork.org, but it still contains an older version(1.0). Also wouldn't it be better to check for contains instead of endsWith? For me the #shorts is not always at the end.