Skip to content

Instantly share code, notes, and snippets.

@Andrew15-5
Created December 18, 2023 00:13
Show Gist options
  • Save Andrew15-5/72d3e57360e7afd63d6f3e6726f84d50 to your computer and use it in GitHub Desktop.
Save Andrew15-5/72d3e57360e7afd63d6f3e6726f84d50 to your computer and use it in GitHub Desktop.
JS one-liner for total hours played in the current queue in YouTube Music
Array.from(document.querySelectorAll('#side-panel #contents.ytmusic-player-queue ytmusic-player-queue-item .duration')).map(element => { const [m, s] = element.getAttribute('title').split(':').map(Number); return m * 60 + s; }).reduce((acc, a) => acc + a, 0) / 3600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment