YouTube - Remove Subscriptions Page

Removes the subscriptions page and Subscriptions links and buttons on youtube.com

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YouTube - Remove Subscriptions Page
// @auhor        Mane
// @version      1.0
// @license      CCO-1.0
// @description  Removes the subscriptions page and Subscriptions links and buttons on youtube.com
// @match        https://www.youtube.com/*
// @grant        none
// @run-at       document-start
// @namespace https://greasyfork.org/users/1491313
// ==/UserScript==

(function() {
  'use strict';

  // 1) Redirect any direct visit to Subscriptions feed
  if (location.pathname === '/feed/subscriptions') {
    location.replace('https://www.youtube.com/');
    return;
  }

  // 2) CSS to hide Subscriptions links/buttons
  var css = `
    /* Sidebar and header link */
    a#endpoint[href="/feed/subscriptions"],
    /* Guide entry renderer */
    ytd-guide-entry-renderer a#endpoint[href="/feed/subscriptions"],
    /* Top bar button (camera icon row) */
    tp-yt-paper-icon-button[title="Subscriptions"],
    /* Any element with title or aria-label Subscriptions */
    [title="Subscriptions"],
    [aria-label="Subscriptions"] {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }
  `;
  var style = document.createElement('style');
  style.textContent = css;
  document.documentElement.appendChild(style);

  // 3) Function to remove any existing Subscriptions nodes
  function removeSubscriptionsLinks() {
    var selectors = [
      'a#endpoint[href="/feed/subscriptions"]',
      'ytd-guide-entry-renderer a#endpoint[href="/feed/subscriptions"]',
      'tp-yt-paper-icon-button[title="Subscriptions"]',
      '[title="Subscriptions"]',
      '[aria-label="Subscriptions"]'
    ];
    selectors.forEach(function(sel) {
      var els = document.querySelectorAll(sel);
      for (var i = 0; i < els.length; i++) {
        els[i].remove();
      }
    });
  }

  // 4) Observe dynamic DOM updates
  removeSubscriptionsLinks();
  if (window.MutationObserver) {
    new MutationObserver(removeSubscriptionsLinks)
      .observe(document.documentElement, { childList: true, subtree: true });
  } else {
    document.addEventListener('DOMNodeInserted', removeSubscriptionsLinks, false);
  }
})();