Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //paste and execute in console on *channel link*/videos
- //change 'to' to the desired number of video length values
- var to = 20; //number of videos
- var list = []; //length array
- for(i = 1;i<=to;i++){
- 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
- list[i-1] = list[i-1].replace(/\s/g, ''); //get rid of whitespace
- var p = list[i-1].split(':'),
- s = 0, m = 1;
- while (p.length > 0) {
- s += m * parseInt(p.pop(), 10);
- m *= 60;
- }
- list[i-1] = s; //convert to seconds
- }
- var a = document.createElement('a');
- var file = new Blob([ list.toString() ], { type: 'text/plain' });
- a.href = URL.createObjectURL(file);
- a.download = 'source';
- a.click(); //download to file "source.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement