Created
September 3, 2022 13:15
-
-
Save assertchris/07670036fcbe6a1e9b060bbe0197da5c to your computer and use it in GitHub Desktop.
This file contains 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
// ==UserScript== | |
// @name Hide all YouTube Music recommendations | |
// @description Hide all recommended YouTube Music playlists from YouTube home page | |
// @version 1.0 | |
// @match https://www.youtube.com | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var found; | |
var interval = setInterval(function() { | |
var recommendation = document.querySelector('[href$="start_radio=1"]:not([clicked])'); | |
if (!recommendation) { | |
return; | |
} | |
var button = recommendation.parentNode?.parentNode?.parentNode?.querySelector('[aria-label="Action menu"]'); | |
if (!button) { | |
return; | |
} | |
recommendation.setAttribute('clicked', 'clicked'); | |
button.click(); | |
setTimeout(function() { | |
document.querySelector('[role="menuitem"]').click(); | |
}, 250); | |
}, 500); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment