Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //paste and execute in console on *channel link*/videos
  2. //change 'to' to the desired number of video length values
  3.  
  4. var to = 20;    //number of videos
  5. var list = [];  //length array
  6.  
  7. for(i = 1;i<=to;i++){
  8.     list[i-1] = $("#items > ytd-grid-video-renderer:nth-child("+i+") > #dismissable > ytd-thumbnail > #thumbnail > #overlays > ytd-thumbnail-overlay-time-status-renderer > span.ytd-thumbnail-overlay-time-status-renderer").html();   //get video length from span
  9.     list[i-1] = list[i-1].replace(/\s/g, '');   //get rid of whitespace
  10.    
  11.     var p = list[i-1].split(':'),
  12.         s = 0, m = 1;
  13.  
  14.     while (p.length > 0) {
  15.         s += m * parseInt(p.pop(), 10);
  16.         m *= 60;
  17.     }
  18.    
  19.     list[i-1] = s;  //convert to seconds
  20.    
  21. }
  22.  
  23. var a = document.createElement('a');
  24. var file = new Blob([ list.toString() ], { type: 'text/plain' });
  25.  
  26. a.href = URL.createObjectURL(file);
  27. a.download = 'source';
  28. a.click();  //download to file "source.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement