Skip to content

Instantly share code, notes, and snippets.

@drifterz28
Created March 2, 2023 16:57
Show Gist options
  • Save drifterz28/6f509d5570fe1ece68e6c24d46b1d0d7 to your computer and use it in GitHub Desktop.
Save drifterz28/6f509d5570fe1ece68e6c24d46b1d0d7 to your computer and use it in GitHub Desktop.
Remove youtube shorts from my subscription feed
// ==UserScript==
// @name Remove shorts from feed
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Removing shorts from feed because they suck
// @author https://github.com/drifterz28
// @match https://www.youtube.com/feed/subscriptions
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
const debounce = (callback, wait) => {
let timeoutId = null;
return (...args) => {
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => {
callback.apply(null, args);
}, wait);
};
}
const getAllvideos = () => {
const ytGrid = document.querySelectorAll('.ytd-grid-renderer[lockup="true"]');
[...ytGrid].forEach((item) => {
if(item.querySelector('[aria-label="Shorts"]')) {
item.style.display = 'none';
}
});
}
(function() {
'use strict';
setTimeout(getAllvideos, 1000);
addEventListener("scroll", debounce(getAllvideos, 300));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment