Skip to content

Instantly share code, notes, and snippets.

@shawnmullaney
shawnmullaney / gist:d0d1707457a62b31725bd7bd7ee0fb36
Created June 21, 2020 02:58 — forked from liaohuqiu/gist:4ee77b9b03afcdecc80252252378d367
Find out the full duration time of a YouTube playlist
var list = document.getElementsByClassName('pl-video-time');
var time = 0;
function toS(hms) {
var a = hms.split(':');
while (a.length < 3) {
a.unshift(0);
}
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return seconds;