Skip to content

Instantly share code, notes, and snippets.

@jergason
Forked from dedsm/videos.js
Created March 13, 2012 18:06
Show Gist options
  • Save jergason/2030351 to your computer and use it in GitHub Desktop.
Save jergason/2030351 to your computer and use it in GitHub Desktop.
Download Coursera videos
(function () {
"use strict";
var curlString = "",
cookieHeader = ' --header \"Cookie:'+ document.cookie + '\" ';
$('li.item_row > a.lecture-link').each(function (index) {
var $lectureLink,
videoLink,
videoName,
subtitleLink,
subtitleName;
$lectureLink = $(this);
videoLink = $lectureLink.attr('href').replace('view','download.mp4');
videoName = '\"' + (index+1) + '.' + $lectureLink.text().trim() + '.mp4\"';
videoName = videoName.replace(/\//g, '-');
curlString +='curl --silent -L' + cookieHeader + videoLink + ' > ' + videoName + " && "
});
console.log(curlString + " echo 'done'");
})();
@jergason
Copy link
Author

Do it all in one go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment