Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Downloading videos from Coursera is not as easy as copy and pasting the link in terminal. I also have tried exporting cookies from my browser in cookie.txt file and doing a:

curl --cookie cookie.txt "https://class.coursera.org/comnetworks-2012-001/lecture/download.mp4?lecture_id=37"

as suggested in this question but that produces a file named download.mp4?lecture_id=37 with nothing in it.

Can somebody tell me how can I download those video lectures? because downloading them with browser is a risk (I have a slow connection and if by chance if some error occurs my too much time is wasted in re-downloading it).

share|improve this question
    
Maybe you have to specify the user-agent of your request via the --user-agent <agent string> switch. A common <agent string> is Mozilla/5.0. –  user1146332 Jan 22 '13 at 8:23
    
@user1146332 I already have --user-agent set in my ~/.curlrc file (the user agent of the browser I am using). –  Santosh Kumar Jan 22 '13 at 8:24

3 Answers 3

You can always use Dhulkee Coursera. It's a gui based application made specially to batch download videos from Coursera.org. Try it ou: http://dhulkeecoursera.blogspot.com.br/2014/02/dhulkee-coursera-has-gone-open-source.html

share|improve this answer

As with any web service, the exact method changes a lot.

In the coursera-dl project, we try to do all the magic. The code involves jumping through some redirects and keeping cookies in place (which changes almost at every login), but you can run it with the --debug option to see how it calls curl or wget or your preferred downloader.

Disclaimer: I am a contributor to the project.

share|improve this answer

The Server responds with the status code 302 that is the requested URI moved temporarily.

If you look into the header of the http-response with

curl -i --cookie cookie.txt <URL>

and there is a valid location given, curl doesn't redo the request for this new location by default. To get curl doing this, you have to add the -L switch to the command line.

So

curl -L --cookie cookie.txt <URL>

should do the job.


Just a note: If you had used wget instead of curl you wouldn't have faced what you've described.

share|improve this answer
    
Are you sure that works? I'm still getting download.mp4?lecture_id=37 with curl by the method you described. wget also doesn't helps much, wget is outputing welcome?type=logout&visiting=%2Fcomnetworks-2012-001%2Flecture%2Fdownload.mp4?l‌​ecture_id=37 –  Santosh Kumar Jan 22 '13 at 9:12
    
It definitely works. I downloaded the video both with curl and wget. It looks like your session was finalized in the meanwhile and you have to get a new valid cookie. –  user1146332 Jan 22 '13 at 9:15
    
What's your ~/.curlrc file? or what are passing additional to curl? –  Santosh Kumar Jan 22 '13 at 9:19
    
without a ~/.curlrc curl -L --user-agent "Mozilla/5.0" --cookie <COOKIE> -o <FILE> <URL> works for me (just tried it again for a second) –  user1146332 Jan 22 '13 at 9:26
    
I get this output. –  Santosh Kumar Jan 22 '13 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.