Created
March 2, 2023 16:57
-
-
Save drifterz28/6f509d5570fe1ece68e6c24d46b1d0d7 to your computer and use it in GitHub Desktop.
Remove youtube shorts from my subscription feed
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 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