Skip to content

Instantly share code, notes, and snippets.



Last active Mar 7, 2018
What would you like to do?
Get course summary from Teachable
var result = $('.section-item .item').get().reduce(function(total, item) {
var text = $(item).text().split("\n").join(" ");
var matches = /.+\((\d):(\d\d)\)/g.exec(text);
var minutes = parseInt(matches[1]);
var seconds = parseInt(matches[2]);
var totalMin = total[0] + minutes;
var totalSec = total[1] + seconds;
if (totalSec > 60) {
totalMin += 1;
totalSec -= 60;
return [totalMin, totalSec]
}, [0,0]);
console.log($('.section-item .item').size() + " micro videos, " + result[0] + " minutes, " + result[1] + " seconds");

This comment has been minimized.

Copy link
Owner Author

@brikis98 brikis98 commented Mar 7, 2018

I needed a way to quickly count the number of videos and the total course duration for courses on Teachable. There's no obvious way to find this info in the UI, so I wrote a very hacky JS script to calculate it.


  1. Go to the page for the course (e.g.,
  2. Open the web dev console
  3. Paste the script above and hit enter
  4. You should get output like: "30 micro videos, 92 minutes, 53 seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment