Skip to main content

Getting rid of YouTube Music's "Are you still listening?" dialog

1 min read (219 words)

Sidebar

YouTube Music is a great way to listen for music for free, and with no adverts if you use an adblocker. There is one annoying problem however: after listening for a while, Youtube will keep pausing the music to show a dialog which says "Are you still listening?". This article will show how to automatically confirm the dialog.

YouTube Music is a great way to listen for music for free, and with no adverts if you use an adblocker. There is one annoying problem however: after listening for a while, Youtube will keep pausing the music to show a dialog which says “Are you still listening?”. This article will show how to automatically confirm the dialog.

First, you need to install a plugin to allow running custom JavaScript on web pages. I used Greasemonkey/Tampermonkey (Firefox | Chrome), it seems to be the most popular plugin for this task.

Open up the plugin’s menu, and click “new user script”. Open up the menu again, select the script and click “edit”. Paste the following code as the source:

// ==UserScript==
// @name     Youtube Music Listening Clicker
// @version  1
// @grant    none
// ==/UserScript==

setInterval(() => {
  if (!document.querySelector("paper-dialog.ytmusic-popup-container").getAttribute("aria-hidden"))
    document.querySelector(".ytmusic-you-there-renderer .style-blue-text .size-default").click();
}, 1000);

console.log("Youtube Music Listening Clicker loaded")

Save and go back to the plugin’s menu, select the script, and click “User script options”. Add “music.youtube.com” to the scripts include textbox and check “Only use these” below.

Reload youtube music if you have it open. Enjoy no more annoying dialogs!

Please note: the music may still pause for a second or so if the tab isn’t focused, due to Firefox/Chrome limiting JavaScript in the backend. There’s no real fix for this. One way to reduce the dialog from appearing at all is to just play another playlist when the dialog first appears, otherwise it will just keep asking.

rubenwardy's profile picture, the letter R

Hi, I'm Andrew Ward. I'm a software developer, an open source maintainer, and a graduate from the University of Bristol. I’m a core developer for Luanti, an open source voxel game engine.

Comments

Leave comment

Shown publicly next to your comment. Leave blank to show as "Anonymous".
Optional, to notify you if rubenwardy replies. Not shown publicly.
Max 1800 characters. You may use plain text, HTML, or Markdown.