Skip to content

Instantly share code, notes, and snippets.

@coderobe
Last active March 23, 2024 20:28

Revisions

  1. coderobe revised this gist Mar 23, 2024. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion yt-playlist-total-length.js
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,6 @@
    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)
    .reduce((N,y,_,a)=>a[(z=y[g+i]).videoId]??=N+=+z.lengthSeconds,0)

    // authors: coderobe, ilbelkyr
  2. coderobe revised this gist Mar 23, 2024. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion yt-playlist-total-length.js
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,7 @@
    // 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)
    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)
  3. coderobe created this gist Mar 23, 2024.
    5 changes: 5 additions & 0 deletions yt-playlist-total-length.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    // 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)