Created
January 14, 2019 15:41
-
-
Save elkhadiy/77f73ee65b73ec94a143a3545e670d1a to your computer and use it in GitHub Desktop.
youtube playlist add duration
This file contains hidden or 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
let timedelta = document.getElementById("stats").firstElementChild.cloneNode(true); | |
timedelta.innerText = (seconds => `${Math.floor(seconds/3600)}:${Math.floor(seconds/60) % 60}:${Math.floor(seconds) % 60}`).call(this, Array.from(document.getElementsByClassName('ytd-thumbnail-overlay-time-status-renderer')).map(x => x.innerText.split(":").map(x => parseInt(x, 10)).reduce((acc, val) => acc * 60 + val)).reduce((acc, val) => acc + val)); | |
document.getElementById("stats").insertBefore(timedelta, document.getElementById("stats").firstElementChild.nextSibling); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment