Hide Members Only Filter and whitelist for youtube

Auto-hide "Members only" videos from untrusted channels on YouTube with a toggle to re-show/hide them

As of 2025-04-19. See the latest version.

Author
S M
Ratings
0 0 0
Version
2.1
Created
2025-04-19
Updated
2025-04-19
Size
5.09 KB
License
MIT
Applies to

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.