Skip to content

Instantly share code, notes, and snippets.

@dedsm
Forked from csabapalfi/videos.js
Created March 7, 2012 14:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dedsm/1993413 to your computer and use it in GitHub Desktop.
Save dedsm/1993413 to your computer and use it in GitHub Desktop.
Download Coursera videos
javascript:(function(){
$('a.lecture-link').each(function (index){
var $lectureLink = $(this);
var videoLink = $lectureLink.attr('href').replace('view','download.mp4');
var subtitleLink = $lectureLink.attr('href').trim().replace('view','subtitles').replace('lecture_id', 'q') + "_en";
var videoName = '\"' + (index+1) + '.' + $lectureLink.text().trim() + '.mp4\"';
var subtitleName = '\"' + (index+1) + '.' + $lectureLink.text().trim() + '.srt\"';
var cookieHeader = ' --header \"Cookie:'+ document.cookie + '\" ';
console.log('curl -L' + cookieHeader + videoLink + ' > ' + videoName);
console.log('curl -L' + cookieHeader + subtitleLink + ' > ' + subtitleName);
});
})();
@christiangenco
Copy link

I expanded this code into a bookmarklet.

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