NoShorts – YT

Removes those annoying shorts from your search/homepage

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         NoShorts – YT
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Removes those annoying shorts from your search/homepage
// @author       OndryDEV
// @match        https://www.youtube.com/*
// @icon         https://www.adexchanger.com/wp-content/uploads/2023/11/shorts600.jpg
// @license MIT
// @grant        none
// ==/UserScript==

// IF REDISTRIBUTING CREDIT ME

// dont mind @icon xd im too lazy to make logo
(function() {
    'use strict';

    // remove
    function removeShorts() {
        var titles = document.querySelectorAll("span#title");
        titles.forEach(function(title) {
            if (title.textContent.includes("Shorts")) {
                var parentDiv = title.closest("div#dismissible, ytd-reel-shelf-renderer");
                if (parentDiv) {
                    parentDiv.parentNode.removeChild(parentDiv);
                }
            }
        });
     // for yt videos (hidden shorts)
        var shortsTitles = document.querySelectorAll("span[aria-label='Shorts']");
        shortsTitles.forEach(function(title) {
            var parentDiv = title.closest("div#dismissible");
            if (parentDiv) {
                parentDiv.parentNode.removeChild(parentDiv);
            }
        });
    }

    // clock
    function noShorts() {
        removeShorts();
        setTimeout(noShorts, 500); // Check every second
    }

    // call func
    noShorts();
})();