Skip to content

Instantly share code, notes, and snippets.

@davidwparker
Created December 22, 2012 06:38
Show Gist options
  • Save davidwparker/4357789 to your computer and use it in GitHub Desktop.
Save davidwparker/4357789 to your computer and use it in GitHub Desktop.
Run this in console of youtube history page (after expanding out history) to get count of video time
var data=document.getElementsByClassName('video-time');
var re = /^([2][0-3]|[0-1]?[0-9])([.:][0-5]?[0-9])?$/;
var total=0;
for(var i=0;i<data.length;i++){
var j=data.item(i).innerText;
var match=re.exec(j);
if (match != null) {
total += parseInt(match[1])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment