Skip to content

Instantly share code, notes, and snippets.

@nathan130200
Created May 22, 2022 11:52
Show Gist options
  • Save nathan130200/0d330e6c245d91778506ec51809de339 to your computer and use it in GitHub Desktop.
Save nathan130200/0d330e6c245d91778506ec51809de339 to your computer and use it in GitHub Desktop.
Remove youtube 'shorts' video type from your feed/subscriptions page.
// ==UserScript==
// @name Shorts Blocker
// @version 0.1
// @description Remove all 'shorts' video kind from youtube feed/subscriptions page.
// @match https://www.youtube.com/feed/subscriptions
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(() => {
'use strict';
function expandParent(node, index) {
if (index > 0) return expandParent(node.parentElement, index - 1);
return node;
}
window.timers = window.timers || {};
window.timers.SHORTS_REMOVER_TIMER_ID = setInterval(() => {
try {
for (let node of document.querySelectorAll('ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"]')) {
//node.parentElement.parentElement.parentElement.parentElement.parentElement.remove()
var el = expandParent(node, 5);
el.remove();
console.log('removed short video from feed.');
}
}
catch (e) {
}
}, 1);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment