Last active
August 15, 2021 19:33
-
-
Save angel333/3dbfcb678938163e74dd5ec47043a7a0 to your computer and use it in GitHub Desktop.
Youtube playlist duration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just copy this into console while on a playlist page (https://www.youtube.com/playlist?list=.....) | |
alert(((document) => { | |
let seconds = Array.from(document.querySelectorAll('.pl-video-time .timestamp span')) | |
.map((span) => { | |
let time = span.textContent.split(':'); | |
return (Number(time[0]) * 60) + Number(time[1]); | |
}) | |
.reduce((a,b) => { | |
return a + b; | |
}); | |
let total = { | |
hours: Math.floor(seconds/(3600)), | |
minutes: Math.floor((seconds%3600)/60), | |
seconds: (seconds%60) | |
}; | |
return 'Playlist duration: ' + total.hours + ' hours, ' + total.minutes + ' minutes, ' + total.seconds + ' seconds'; | |
})(document)); |
H-G-Hristov
commented
Jan 16, 2020
I made an app to do that, hosted on Heroku. It can find the total length of a playlist that has up to 500 videos. If it has more than 500 videos, it shows the total length of the first 500 videos.
YouTube Playlist Length (https://ytplaylist-len.herokuapp.com/)
You should make the 'edit box' much longer and also it would be nice if it is possible to just put the full URL not just the ID.
YouTube Playlist Length (https://ytplaylist-len.herokuapp.com/)
Awesome!
Could you share app repo?
Yes, please.
You should make the 'edit box' much longer and also it would be nice if it is possible to just put the full URL not just the ID.
@H-G-Hristov
I've made the changes you suggested!
Thank you.
Get YouTube playlist length visit:- YouTube playlist length
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment