Skip to content

Instantly share code, notes, and snippets.

@willjobs
Created November 29, 2017 08:10
Show Gist options
  • Save willjobs/e6f267e1af5abadcdec1b9292e95bddc to your computer and use it in GitHub Desktop.
Save willjobs/e6f267e1af5abadcdec1b9292e95bddc to your computer and use it in GitHub Desktop.
JS code to summarize the amount of video content on the Magoosh GRE site (https://gre.magoosh.com/lessons)
overall_sum = 0;
$('.thin.list-unstyled.lesson-list-condensed').each(function(idx, el) {
sum = 0;
$(el).find('.lesson-item').each(
function(idx2, inner_el) {
time = $(inner_el).find('.lesson-item-subtitle').text();
time = time.split(':');
if(time.length > 1) {
sum += parseInt(time[0]) + parseInt(time[1])/60;
}
}
);
console.log('index: ' + (idx+1) + ', sum=' + sum.toFixed(2) + ' minutes');
overall_sum += sum;
}
);
console.log('overall sum: ' + overall_sum.toFixed(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment