YouTube "Not Interested" Button Script

Step 1: Install Tampermonkey

Download and install Tampermonkey from www.Tampermonkey.net.

Step 2: Create a New Script

Click on Create New Script in the Tampermonkey dashboard.

Step 3: Paste the Following Code

// ==UserScript== // @name YouTube Show "Not Interested" Option on Homepage // @namespace http://tampermonkey.net/ // @version 1.3 // @description Adds a "Not Interested" button below the video title on the YouTube homepage. // @author YourName // @match https://www.youtube.com/ // @grant none // ==/UserScript== (function () { 'use strict'; // Function to add the "Not Interested" button next to each video function addNotInterestedButtons() { // Select all video elements on the homepage const videoCards = document.querySelectorAll('ytd-rich-item-renderer'); videoCards.forEach((card) => { // Check if the button already exists if (card.querySelector('.custom-not-interested-button')) return; // Create the "Not Interested" button const notInterestedButton = document.createElement('button'); notInterestedButton.textContent = 'Not Interested'; notInterestedButton.className = 'custom-not-interested-button'; // Style the button notInterestedButton.style.marginTop = '5px'; notInterestedButton.style.padding = '5px 10px'; notInterestedButton.style.backgroundColor = '#FFCC00'; notInterestedButton.style.color = '#000000'; notInterestedButton.style.border = 'none'; notInterestedButton.style.cursor = 'pointer'; notInterestedButton.style.borderRadius = '3px'; notInterestedButton.style.display = 'block'; // Add functionality to simulate the "Not Interested" option notInterestedButton.onclick = () => { const ellipsisButton = card.querySelector('#button[aria-label*="Action menu"]'); if (ellipsisButton) { // Open the ellipsis menu ellipsisButton.click(); // Wait briefly and then select "Not Interested" setTimeout(() => { const notInterestedOption = document.evaluate( "//yt-formatted-string[contains(text(), 'Not interested')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue; if (notInterestedOption) { notInterestedOption.click(); console.log('Video marked as Not Interested.'); } else { console.error('Could not find the "Not Interested" option.'); } }, 500); } else { console.error('Could not find the action menu.'); } }; // Append the button below the video title const titleContainer = card.querySelector('#meta'); if (titleContainer) { titleContainer.appendChild(notInterestedButton); } }); } // Observe for dynamically loaded video elements const observer = new MutationObserver(addNotInterestedButtons); observer.observe(document.body, { childList: true, subtree: true }); // Initial call addNotInterestedButtons(); })();

Step 4: Try It Out!

Visit YouTube's homepage and see the "Not Interested" button in action!

[ Edward Collier's NewWorldAddress.com City: Orlando Tue Nov 26 2024 20:35:48 GMT-0500 (Eastern Standard Time) ]