Last active
March 23, 2024 20:28
-
-
Save coderobe/65db029255122de630c4498daeb4ec86 to your computer and use it in GitHub Desktop.
get total content play time of a youtube playlist in seconds
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
// open a playlist, or Watch Later (https://www.youtube.com/playlist?list=WL) | |
// run. doesn't work? that means the playlist is truncated. scroll all the way down and try again. | |
// output is in seconds. divide by 3600 for fractional hours. | |
ytInitialData[b="contents"]["twoColumnBrowseResults"+(i="Renderer")] | |
.tabs[0]["tab"+i] | |
.content["sectionList"+i][b][0]["itemSection"+i][b][0][(g="playlistVideo")+"List"+i][b] | |
.reduce((N,y,_,a)=>a[(z=y[g+i]).videoId]??=N+=+z.lengthSeconds,0) | |
// authors: coderobe, ilbelkyr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this snippet is small enough to fit in a tweet btw
https://twitter.com/coderobe/status/1771631600024895952