Last active
January 6, 2019 13:51
-
-
Save xMajedz/742963c1615babe6380b9e146aa0f89e to your computer and use it in GitHub Desktop.
This file contains 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
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesn't work with all playlists
they store playlist data in different objects