Created
December 29, 2023 16:51
-
-
Save TheToddLuci0/7cf91c0d02736c0788d4e7290cea2a27 to your computer and use it in GitHub Desktop.
Quick hack to find the number of videos and average length in one of the lessons on learn.cantrill.io. Will probably also work on other teachable platforms, but that's where this was originally written for.
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
function conv(time){ | |
let s = time.split(':'); | |
return parseInt(s[0]) + (parseInt(s[1])/60); | |
} | |
let names = document.getElementsByClassName("lecture-name"); | |
let total_time = 0 | |
let videos = 0 | |
const re = /\d+:\d\d/ | |
for (var i=0; i < names.length; i++){ | |
let t = names[i].innerText.match(re); | |
if (t !== null){ | |
time = conv(t[0]) | |
videos += 1 | |
total_time += time | |
}} | |
total_time / videos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment