您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes shorts and community posts from the YouTube homepage
// ==UserScript== // @name YT-no-shorts-no-posts // @namespace http://tampermonkey.net/ // @version 2025-04-21 // @description Removes shorts and community posts from the YouTube homepage // @author You // @include *://*.youtube.com* // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com // @grant none // @license GNU GPLv3 // ==/UserScript== (function() { 'use strict'; function getElementByXpath(path) { return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; } function removeElementsByXpath(path) { let element = getElementByXpath(path); // Select elements by class element.remove(); // Remove each element } const observer = new MutationObserver(() => removeElementsByXpath('//ytd-rich-shelf-renderer[@is-shorts=""]/../..')); observer.observe(document.body, { childList: true, subtree: true }); const observer2 = new MutationObserver(() => removeElementsByXpath('//span[.="Latest YouTube posts"]/../../../../../../../../..')); observer2.observe(document.body, { childList: true, subtree: true }); })();