Skip to content

Instantly share code, notes, and snippets.

@egoing
Last active January 8, 2018 13:51
Show Gist options
  • Save egoing/11163965 to your computer and use it in GitHub Desktop.
Save egoing/11163965 to your computer and use it in GitHub Desktop.
Youtube에서 재생목록의 총재생시간을 알아내는 스크립트
var times = document.querySelectorAll('.pl-video .pl-video-time .timestamp span');
var duration = 0;
for(var i=0; i<times.length; i++){
var t = times[i];
t = t.innerText;
t = t.split(':')
min = t[0];
sec = t[1];
duration = duration + parseInt(sec) + parseInt(min)*60
}
console.log(duration/60/60);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment