您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto-hide "Members only" videos from untrusted channels on YouTube with a toggle to re-show/hide them. Optionally leave layout gap with config flag (handles sidebar safely too). Includes fallback logic for non-existent parent elements.
YouTube Members Only Filter — What It Does
This userscript automatically hides "Members only" videos on YouTube from channels you haven’t whitelisted, so you can see channels you have a membership to's member videos but hide ones you don't. Just edit the code to add your desired channels to the whitelist
🔍 Where It Works
✅ Sidebar / Suggested Videos — Hidden completely
📄 Channel's “Videos/shorts/etc...” Tab / Grids — Leaves a blank space where the video was, so you know something was there
⚙️ How to Whitelist Channels
At the top of the script, you'll find this section:
const WHITELIST = [
'Linus Tech Tips',
' Some Channel ',
'trusted creator'
];
Add any channels you trust here.
✅ Whitelist Rules:
Case-insensitive
Leading/trailing spaces are trimmed
Partial match — e.g. 'linus' will match 'Linus Tech Tips'
🔁 Toggle Button (Tampermonkey Menu)
In the Tampermonkey dropdown, click:
"Toggle Member Filter On/Off"
Here’s what it does:
✅ On (default): Hides members-only videos from non-whitelisted channels
🔁 Off: Reveals previously hidden videos on the current page only
Note: The toggle state does not persist across page reloads.
⏱ Why It Auto-Enables After 5 Seconds
YouTube loads and updates content unpredictably — not always when the page loads.
To avoid running too early (before videos appear), the script waits about 4.5 seconds after the page loads before kicking in. That way, it has a better chance of catching visible videos.
🔄 Why It Repeats
YouTube is a single-page app (SPA), which means it often changes content without reloading the whole page.
Since there’s no perfect way to detect every change, the script:
Repeats its scan regularly (especially during the first minute)
Then slows down to avoid overloading
Keeps re-checking for new videos that may have been added
This ensures filtering works even if the page changes without a reload.
UPDATE: Added LEAVE_BLANK_SPACE_WHEN_HIDDEN to top on request. Set this to false to "hide the empty spots on channel pages"