hide-music-recs.js
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); | |
})(); | |