Skip to content

Instantly share code, notes, and snippets.

@kinwahlai
Created June 18, 2013 02:55
Show Gist options
  • Save kinwahlai/5802359 to your computer and use it in GitHub Desktop.
Save kinwahlai/5802359 to your computer and use it in GitHub Desktop.
This script is originally created by Evadne Wu (https://gist.github.com/evadne/5794585) which generate curl command for PDF, SD and HD. I modified it slightly just to output the curl command HD video.
NodeList.prototype.toArray = function () {
return Array.prototype.slice.call(this);
};
[].concat.apply([], document.querySelectorAll("li.session").toArray().map(function(session){
var sessionID = session.id.match(/^\d+/)[0];
var title = session.querySelector(".title").innerText;
var track = session.querySelector(".track").innerText;
var date = session.querySelector(".date").innerText;
var allLinks = session.querySelectorAll("a[href^='http://devstreaming']").toArray();
var titleText = "Session " + sessionID + " - " + title;
return allLinks.map(function(link){
var filename = link.pathname.match(/([^/]+)\.[^\.]+/)[0];
return "curl \"" + link.href + "\" -o \"" + titleText + " - " + filename + "\" & ";
});
})).reject(function(x){
return x.indexOf("-SD.mov?dl=1") >= 0 || x.indexOf(".pdf?dl=1") >= 0
}).map(function(x){
console.log(x);
return x;
}).join("\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment