Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name YouTube Shorts Remover
- // @namespace Deez Nutz
- // @match https://*youtube.com/results*
- // @grant none
- // @version 1.1
- // @author -
- // @description Remove YT search results that are shorts
- // ==/UserScript==
- (function() {
- let observer = new MutationObserver(handler);
- function handler(mutations) {
- for (let mutation of mutations) {
- if (mutation.type === 'childList') {
- let target = mutation.target;
- if(target.id == 'overlays' && target.className.includes('ytd-thumbnail')) {
- target.childNodes.forEach(function(childNode) {
- if(childNode.getAttribute('overlay-style') == 'SHORTS') {
- target.closest('ytd-video-renderer').remove();
- }
- });
- }
- }
- }
- }
- observer.observe(
- document.getElementsByTagName("body")[0],
- { subtree: true, childList: true }
- );
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement