Skip to content

Instantly share code, notes, and snippets.

@assertchris
Created September 3, 2022 13:15
Show Gist options
  • Save assertchris/07670036fcbe6a1e9b060bbe0197da5c to your computer and use it in GitHub Desktop.
Save assertchris/07670036fcbe6a1e9b060bbe0197da5c to your computer and use it in GitHub Desktop.
// ==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