Skip to content

Instantly share code, notes, and snippets.

@AprilSylph
Created February 28, 2026 21:41
Show Gist options
  • Select an option

  • Save AprilSylph/05e298167b36f63ad7698c76aad7b124 to your computer and use it in GitHub Desktop.

Select an option

Save AprilSylph/05e298167b36f63ad7698c76aad7b124 to your computer and use it in GitHub Desktop.
YouTube Playlist Running Time Tally
HOW TO USE
  1. Copy the contents of youtube-playlist-tally.js
  2. Open a YouTube playlist in your browser
    • Important: Do not scroll down; this will load recommendations, which will mess up the tally!
  3. Open your browser's devtools → Console
  4. Paste the contents of your clipboard and press Enter
  5. Done! Your console should return the total runtime of the playlist as a string.
LIMITATIONS
  • This won't work if any video in the playlist is more than an hour long.
  • Output is in MM:SS only. If the total is over one hour (MM >= 60), you will have to convert it to HH:MM:SS yourself.
(() => {
const secondsTotal = [...document.querySelectorAll('ytd-thumbnail-overlay-time-status-renderer')]
.map((element) => element.textContent.trim())
.map((textContent) => textContent.slice(0, textContent.indexOf('\n')))
.reduce((accumulator, currentValue) => {
const [minutes, seconds] = currentValue.split(':');
return accumulator + (parseInt(minutes) * 60) + parseInt(seconds);
}, 0);
const minutesTotal = Math.floor(secondsTotal / 60);
const secondsLeftover = Math.floor(secondsTotal % 60);
return `${minutesTotal}:${String(secondsLeftover).padStart(2, '0')}`
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment