Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. videos = $$('.pl-video .timestamp');
  2. videos = videos.map(v => v.innerText);
  3. sum = 0;
  4. for(video of videos) {
  5. video = video.split(':');
  6. const videoTime = parseInt(video[1]) + (parseInt(video[0])*60);
  7. sum += videoTime;
  8. }
  9.  
  10. std = Math.floor(sum / 3600);
  11. sum -= std * 3600;
  12.  
  13. min = Math.floor(sum / 60);
  14. sum -= min * 60;
  15.  
  16. s = sum;
  17.  
  18. console.log(`${std}h ${min}m ${s}s`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement