Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

YouTube #544

Open
Open

Description

@Akash2372

// ==UserScript==
// @name Hide YouTube Shorts
// @namespace http://tampermonkey.net/
// @Version 0.1
// @description Hide YouTube Shorts on YouTube
// @author Your Name
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Function to hide elements with specific selectors
function hideShorts() {
    const shortsSelectors = [
        'ytd-rich-section-renderer[header-style="SHORTS"]', // Shorts section on homepage
        'ytd-grid-video-renderer[is-shorts]', // Shorts in subscription feed
        'ytd-reel-shelf-renderer' // Shorts in explore
    ];

    shortsSelectors.forEach(selector => {
        const elements = document.querySelectorAll(selector);
        elements.forEach(element => {
            element.style.display = 'none';
        });
    });
}

// Run the function initially
hideShorts();

// Create a MutationObserver to watch for changes and hide Shorts dynamically
const observer = new MutationObserver(hideShorts);
observer.observe(document.body, { childList: true, subtree: true });

})();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions