Last active
December 16, 2025 00:06
-
-
Save bryanseah234/e851d12c9a1caefa697ab5051a667050 to your computer and use it in GitHub Desktop.
youtube-notifications-code (code to set all notifications to none)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Automate setting YouTube Subscription Notifications to "None" | |
| * TARGETS: | |
| * Button: ytd-subscription-notification-toggle-button-renderer-next | |
| * Menu Item: ytd-menu-service-item-renderer containing "None" | |
| */ | |
| (async function setNotificationsToNone() { | |
| console.log("--- STARTING FINAL SCRIPT ---"); | |
| const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); | |
| // Get all channel rows | |
| const channels = document.querySelectorAll('ytd-channel-renderer'); | |
| console.log(`Found ${channels.length} channels.`); | |
| for (let i = 0; i < channels.length; i++) { | |
| const channel = channels[i]; | |
| const channelName = channel.querySelector('#text.ytd-channel-name')?.textContent.trim() || `Channel ${i}`; | |
| // 1. Find the new button container | |
| const bellContainer = channel.querySelector('ytd-subscription-notification-toggle-button-renderer-next'); | |
| if (!bellContainer) { | |
| // Try fallback to old selector just in case mixed A/B testing | |
| const oldBell = channel.querySelector('ytd-subscription-notification-toggle-button-renderer'); | |
| if (!oldBell) { | |
| console.log(`[${i}/${channels.length}] Skipping ${channelName}: No bell found.`); | |
| continue; | |
| } | |
| } | |
| // 2. Click the button to open the menu | |
| const bellButton = bellContainer ? bellContainer.querySelector('button') : channel.querySelector('ytd-subscription-notification-toggle-button-renderer button'); | |
| bellButton.click(); | |
| // Wait for the pop-up menu (vital) | |
| await sleep(400); | |
| // 3. Find the "None" option based on your snippet | |
| // We look for all menu items visible on screen | |
| const menuItems = document.querySelectorAll('ytd-menu-service-item-renderer'); | |
| let noneClicked = false; | |
| for (const item of menuItems) { | |
| // We strip whitespace to match exactly "None" | |
| if (item.textContent.trim() === "None") { | |
| item.click(); | |
| console.log(`[${i}/${channels.length}] ${channelName} -> Set to NONE`); | |
| noneClicked = true; | |
| break; // Stop loop once clicked | |
| } | |
| } | |
| if (!noneClicked) { | |
| // It might already be set to None, or the menu looks different | |
| console.log(`[${i}/${channels.length}] ${channelName}: 'None' option not found (or already set).`); | |
| // Click bell again to close the open menu | |
| bellButton.click(); | |
| } | |
| // 4. Rate limit pause | |
| await sleep(500); | |
| } | |
| console.log("--- ALL DONE ---"); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment