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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
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.
Instructions: