Hide Members Only Filter and whitelist for youtube

Auto-hide "Members only" and "Members first" 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. Updated to handle change in YouTube sidebar. Added loop prevention with stable parent check and hiding attempts counter.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

作者
S M
今日安裝
4
安裝總數
234
評價
3 1 0
版本
2.91
建立日期
2025-04-19
更新日期
2025-10-16
尺寸
12.0 KB
授權條款
MIT
腳本執行於

YouTube Members Only Filter — What It Does

This userscript automatically hides "Members only" and "Members first" 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" or true to show gaps where videos were removed.