Wis / YouTube playlist duration

// ==UserScript==
// @name         YouTube playlist duration
// @namespace    http://tampermonkey.net/
// @icon         https://www.google.com/s2/favicons?domain=youtube.com
// @version      1.0
// @description  get total duration of a playlist in an alert by pressing alt + shift + U on a playlist page.
// @author       Wis
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

function doc_keyUp(e) {
  if (e.altKey && e.shiftKey && e.key == "U") {
    let minutes = [...document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer > span")]
      .reduce((acc, dur) => {
        dur = dur.textContent.trim().split(':');
        return acc + parseInt(dur[0]) * 60 + parseInt(dur[1]);
      }, 0) / 60;
    alert(Math.floor(minutes / 60) + " hours " + minutes % 60 + " minutes.");
  }
}
document.addEventListener('keyup', doc_keyUp, false);