Skip to content

Instantly share code, notes, and snippets.

View dedsm's full-sized avatar

David De Sousa dedsm

View GitHub Profile
@dedsm
dedsm / videos.js
Created March 7, 2012 14:22 — forked from csabapalfi/videos.js
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);