Auto-skip disliked music in YouTube Music
This is a bit off-topic from the usual blog posts, but I want to post it as the default user experience of YouTube Music to play disliked music is baffling to me. I simply don't understand why YouTube Music plays songs you've disliked. I could see maybe if it played them only after a certain "snooze" period of weeks, months, etc. But regardless...
I'm justifying this post as a post about considering user experience in application design ๐
How to automatically skip disliked songsโ
Install TamperMonkeyโ
First, this assumes you're using a TamperMonkey compatible browser and are willing / able to install TamperMonkey as an extension to your browser.
This can be an extremely useful tool if you want or need to make small tweaks to the behavior of a website that you frequently use.
Add the following user script to TamperMonkeyโ
Credit goes entirely to GrayStrider on GitHub for posting a UserScript on how to do this about 4 years prior to the writing of this article.
Here is a slightly modified version of the original gist, which includes the required UserScript comment header:
// ==UserScript==
// @name YouTube Music: skip dislikes
// @namespace http://tampermonkey.net/
// @version 2024-11-18
// @description try to take over the world!
// @author You
// @match https://music.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
(function () {
'use strict';
const $$ = (id) => document.getElementById(id);
const $ = (className) => document.getElementsByClassName(className);
const check = () => {
// Log something so it's clear the script is active and working.
// The noise is fine for this use case.
console.log('Checking to see if the current song is disliked...');
let container = $$('like-button-renderer');
let skipBtn = $('next-button')[0];
if (container.getAttribute('like-status') === 'DISLIKE') {
skipBtn.click();
setTimeout(check, 5000);
} else {
setTimeout(check, 500);
}
};
setTimeout(check, 2500);
})();
The original references are here:
- The Reddit post linking to the Gist: https://www.reddit.com/r/YoutubeMusic/comments/ib9d50/userscript_to_automatically_skip_disliked_songs/
- The original Gist: https://gist.github.com/GrayStrider/c483f3c2b5cdb20434530ad3f1da6b8a
Aside: Set up UserScript auto-syncโ
TamperMonkey supports syncing your scripts between computers and browsers. This is definitely worth setting up and only takes a minute.