Skip to content

Instantly share code, notes, and snippets.

@macmladen
Last active April 23, 2021 13:05
Show Gist options
  • Save macmladen/ff40e7c36d05e365c53c5c2f44f0c7d1 to your computer and use it in GitHub Desktop.
Save macmladen/ff40e7c36d05e365c53c5c2f44f0c7d1 to your computer and use it in GitHub Desktop.
When you are on YouTube playlist page and want to know how long will the list play. You can paste it in console and run to get time in hh:mm:ss.
const all = [];
document
.querySelectorAll('ytd-playlist-video-renderer ytd-thumbnail-overlay-time-status-renderer')
.forEach(a => all.push(a.textContent.trim()));
let videosLength = 0;
all.forEach(a => {
const timeSplit = a.split(':');
videosLength += timeSplit[0]*60 + timeSplit[1]*1;
})
console.log("Total list running time: " + new Date(videosLength * 1000).toISOString().substr(11, 8));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment