Skip to content

Instantly share code, notes, and snippets.

@mcharo
Last active December 18, 2015 13:29
Show Gist options
  • Save mcharo/5790556 to your computer and use it in GitHub Desktop.
Save mcharo/5790556 to your computer and use it in GitHub Desktop.
(function() {
var sessions = document.getElementsByClassName("session");
var hd = [];
var sd = [];
var pdf = [];
for (var i = 0; i < sessions.length; i++) {
var session = sessions[i];
var sessionid = session.getAttribute("id");
sessionid = sessionid.substring(0, sessionid.indexOf("-"));
var title = session.getElementsByClassName("title")[0].innerText;
title = sessionid + ' - ' + title;
title = title.replace(":", "");
var download = session.getElementsByClassName("download");
var as = download[0].getElementsByTagName("a");
for (var j = 0; j < as.length; j++) {
if (as[j].innerText == 'HD') {
hd.push('curl -o "' + title + '.mov" ' + as[j].href);
} else if (as[j].innerText == 'PDF') {
pdf.push('curl -o "' + title + '.pdf" ' + as[j].href);
} else if (as[j].innerText == 'SD') {
sd.push('curl -o "' + title + '.mov" ' + as[j].href);
}
}
}
console.log("hd: " + hd.length + ":\n" + hd.join("\n"));
console.log("sd: " + sd.length + ":\n" + sd.join("\n"));
console.log("pdf: " + pdf.length + ":\n" + pdf.join("\n"));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment