Last Updated: February 25, 2016
·
571
· roberocity

Total Video Duration for a Coursera Class

I like Coursera (https://coursera.org/). I've taken several classes. I always want to know how long it will take to watch all of the given videos. Since I try not to do math in my head, I wrote the quick little snippet to calculate the time I'll spend watching videos.

Go to the videos page of the class you are taking. Open up the browser console and copy/past this code. Out will pop the total time in minutes to watch all of the videos at normal speed.

Array.prototype.map.call($('a[data-lecture-id]'), function(t) { var d = $(t).text().match(/\d+:\d+/)[0].split(':'); return +(d[0]*60) + +d[1]; }).reduce(function(e, s) { return s + e; }, 0)/60.0;

This line will show total time, again in minutes, of the videos you still have to watch.

Array.prototype.map.call($('li.unviewed a[data-lecture-id]'), function(t) { var d = $(t).text().match(/\d+:\d+/)[0].split(':'); return +(d[0]*60) + +d[1]; }).reduce(function(e, s) { return s + e; }, 0)/60.0;

Now go learn something from people smarter than me fully prepared to stare at a video for a known amount of time.

If you normally watch videos at a faster pace, just divide the number you see by the speed you normally watch the videos.

600/1.5 // how long it will take to watch 600 minutes of video at 1.5x speed.