Skip to content

Instantly share code, notes, and snippets.

@alexcmgit
Last active September 23, 2022 16:27
Show Gist options
  • Select an option

  • Save alexcmgit/e65c3a8acd2bcfc95d90e95987d178e4 to your computer and use it in GitHub Desktop.

Select an option

Save alexcmgit/e65c3a8acd2bcfc95d90e95987d178e4 to your computer and use it in GitHub Desktop.
Tampermonkey Script that removes all YT shorts from feeds
// ==UserScript==
// @name Go Fuck Off YouTube Shorts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @include https://www.youtube.com*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
function removeShortsCards() {
let id;
function getCards() {
const cards = [...document.querySelectorAll("ytd-grid-video-renderer")];
return cards.filter(c => c.innerHTML.includes('overlay-style="SHORTS"'))
}
function fn() {
for (const e of getCards()) e.remove();
}
window.onload = () => fn();
window.onscroll = () => {
clearTimeout(id);
id = setTimeout(fn, 30);
}
fn()
const interval = setInterval(function() {
fn();
}, 50)
setTimeout(function() {
clearInterval(interval)
}, 3000);
}
(function() {
'use strict';
removeShortsCards()
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment