您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes Home and Shorts buttons, and redirects to Subscriptions feed
当前为
// ==UserScript== // @name YouTube Subscriptions Only // @namespace http://tampermonkey.net/ // @version 1.1.0 // @description Removes Home and Shorts buttons, and redirects to Subscriptions feed // @author Sanokei // @match https://www.youtube.com/* // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to remove Home and Shorts buttons function removeButtons() { // Target both mini-guide and regular guide entries const selectors = [ 'ytd-mini-guide-entry-renderer', 'ytd-guide-entry-renderer' ]; selectors.forEach(selector => { const entries = document.querySelectorAll(selector); entries.forEach(entry => { // Check if the entry is Home or Shorts by examining its title const title = entry.querySelector('.title'); if (title && (title.textContent === 'Home' || title.textContent === 'Shorts')) { entry.style.display = 'none'; } }); }); } // Function to redirect to subscriptions if on homepage function redirectToSubscriptions() { // Only redirect if we're on the homepage (not already on a video or other page) if (window.location.pathname === '/' || window.location.pathname === '/watch') { window.location.href = '/feed/subscriptions'; } } // Function to modify YouTube logo links to go to subscriptions function modifyLogoLinks() { // Target all YouTube logo links const logoLinks = document.querySelectorAll('a.yt-simple-endpoint[href="/"]'); logoLinks.forEach(link => { link.setAttribute('href', '/feed/subscriptions'); }); } // Run the functions periodically to catch dynamic content setInterval(() => { removeButtons(); modifyLogoLinks(); }, 1000); // Run once on initial page load removeButtons(); modifyLogoLinks(); // Redirect if on homepage if (window.location.pathname === '/') { redirectToSubscriptions(); } // Monitor for navigation events within YouTube (for SPA behavior) const pushState = history.pushState; history.pushState = function() { pushState.apply(history, arguments); // Check if we've navigated to the homepage if (window.location.pathname === '/') { setTimeout(redirectToSubscriptions, 100); } // Run functions after navigation setTimeout(() => { removeButtons(); modifyLogoLinks(); }, 500); }; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址