Created
December 18, 2023 00:13
-
-
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
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
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