How to download videos from Coursera with curl

curl

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).

Best 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.