Skip to content

Instantly share code, notes, and snippets.

@xMajedz
Last active January 6, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xMajedz/742963c1615babe6380b9e146aa0f89e to your computer and use it in GitHub Desktop.
Save xMajedz/742963c1615babe6380b9e146aa0f89e to your computer and use it in GitHub Desktop.
var a = 0, s = 0, m = 0, h = 0, b = window.ytInitialData.contents.twoColumnWatchNextResults.playlist.playlist.contents.length;for(i = 0;i < b;i++){var c = window.ytInitialData.contents.twoColumnWatchNextResults.playlist.playlist.contents[a].playlistPanelVideoRenderer.lengthText.simpleText, minsec = c.match(/\d+/g), ts = parseInt(minsec[1]), tm = parseInt(minsec[0]), s = s + ts, m = m + tm;if (s >= 60){s = s - 60, m = m + 1}if (m >= 60){m = m - 60, h = h + 1}a = a + 1}console.log(h + 'hours ' + m + 'minutes ' + s + 'seconds');
@xMajedz
Copy link
Author

xMajedz commented Nov 5, 2017

doesn't work with all playlists
they store playlist data in different objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment