Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. (function() {
  2.  
  3. var playlist = document.querySelector("ytd-playlist-video-list-renderer"),
  4. timeSeconds = 0,
  5. timesContainer = playlist.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");
  6.  
  7. for(var i = 0; i < timesContainer.length; i++){
  8. var timeStr = timesContainer[i].childNodes[0].innerHTML,
  9. timeParts = timeStr.split(":"),
  10. seconds = (timeParts[0] * 60) + parseInt(timeParts[1]);
  11.  
  12. timeSeconds += seconds;
  13. }
  14.  
  15. var hours = (timeSeconds / 60) / 60,
  16. minutes = (timeSeconds / 60) % 60,
  17. seconds = (timeSeconds % 60),
  18. result = parseInt(hours) + " hours : " + parseInt(minutes) + " minutes : " + parseInt(seconds) + " seconds";
  19.  
  20. alert(result);
  21.  
  22. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement