Block YouTube Shorts Completely

Hides YT Shorts (I use this to focus better on my work)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name                Block YouTube Shorts Completely
// @namespace    http://tampermonkey.net/
// @version            2.0
// @description    Hides YT Shorts (I use this to focus better on my work)
// @author             Emree.el on instagram 
// @match             https://www.youtube.com/*
// @grant               none
// @license           MIT
// ==/UserScript==

(function() {
    'use strict';

    const removeShorts = () => {
        const selectors = [
            'ytd-rich-shelf-renderer:has(a[href^="/shorts"])',
            'ytd-reel-shelf-renderer',
            'a[href^="/shorts"]',
            'ytd-grid-video-renderer:has(a[href^="/shorts"])',
            'ytd-reel-item-renderer',
            'ytd-video-renderer:has(a[href*="shorts"])',
            'a[title="Shorts"]', // Sidebar Shorts button
            'a[href="/shorts"]'   // Any other direct shorts button
        ];

        selectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => el.remove());
        });
    };

    setInterval(removeShorts, 1000); // run every second to clean up
})();