Edit: I do not maintain this script anymore, dgorissen forked this and made it better – https://github.com/dgorissen/coursera-dl
After taking two Coursera classes(db and algo), I wanted a simpler way to download the lecture assets(video files, pdf, ppt etc) from the site.
The features that I was looking for in the downloader:
1. Bulk download from the command prompt.
2. The downloader should recreate the structure present in the video listings page i.e it should create directories corresponding to each weekly topic and their sub topics and download the files into the appropriate directories.
3. The downloader should be smart as in when it is run each time from the command prompt, it should know the assets previously downloaded and download only the newly updated assets. Speaking in programmer terms, it should diff between all the previous downloads and the assets in the current page and download only the newly added ones.
Hence, my free time during the last few days were dedicated to scripting this. The Python script that I wrote for this can be downloaded from github. Extract the contents of the zipped file to the directory where you want the assets to be downloaded and run the python script. More info is present in the readme.txt file accompanying the script. The script recreates the structure present in the video listings page and downloads the assets to the appropriate directories.
The image below shows the directories created and some of the files downloaded for automata course.
Compare the above with the course structure present in the video listings page of automata course:
Whenever new lessons are posted, just run the script and the script takes care of downloading the updated contents. It keeps track of already downloaded files and hence only downloads the newly updated contents.
Give it a spin and let me know how it works for you.
Hi,
I have also created an APPYnote room for HNers who are on Coursera…feel free to join in:
http://hadron.appynote.com/sl/?pr=38-99c11274989811e1
regards
Edmond
Thanks for your work. I found one “bug”. Try to download CS101 and you’ll receive this message:
Downloading resource – https://class.coursera.org/cs101/wiki/view?page=code-1
Traceback (most recent call last):
File “download.py”, line 2312, in
main()
File “download.py”, line 2301, in main
downloader.download(classResource, className)
File “download.py”, line 2128, in download
with open(fileName, mode) as fp:
IOError: [Errno 22] invalid mode (‘wb’) or filename: u’view?page=code-1′
CS101, in it’s asset list, has a link to the wiki which is not a downloadable content. That is why the script is barfing. Let me see what I can do to fix this.
Have fixed this now. Grab the latest download.
Tnanks š
It also barfs on SaaS.
Traceback (most recent call last):
File “download.py”, line 2389, in
main()
File “download.py”, line 2378, in main
downloader.download(classResource, className)
File “download.py”, line 2193, in download
with open(fileName, mode) as fp:
IOError: [Errno 2] No such file or directory: ‘3 – 1 – 2.1, 2.2 – The Web as a Client-Server System; TCP/IP Introduction.txt’
This should have been fixed as part of this – https://abhirama.wordpress.com/2012/05/02/script-to-download-coursera-videos/#comment-825.
Thank you for this excellent piece of software. I have found it most excellent, and it appears to work for almost all cases, except for one.
For hci-class.org, there is a bug with downloading one of the recent lectures:
Downloading resource – https://d19vezwu8eufl6.cloudfront.net/hci/slides_pdf%2FHCI-05-2-HeuristicsFirstHalf.pdf
Downloading resource – https://class.coursera.org/hci/lecture/download.mp4?lecture_id=28
Traceback (most recent call last):
File “download.py”, line 2389, in
main()
File “download.py”, line 2378, in main
downloader.download(classResource, className)
File “download.py”, line 2193, in download
with open(fileName, mode) as fp:
IOError: [Errno 2] No such file or directory: ‘5 – 2 – Lecture 5.2 Design Heuristics (Part 1/2) (2002).mp4’
The reason is because there is a “/” in the filename which causes the script to create a directory within a directory, at least on MacOS X, which causes the rest of the script to choke up.
Have fixed this. Grab the latest download.
getting an error while trying to run download.py from python 3.2.1 IDLE
as “Invalid syntax”
This script is not written for python 3.x. I have never tested it with python 3.
These are the errors encountered when i tried it from python IDLE. i am running ur script on ubuntu 12.04. plz help
Traceback (most recent call last):
File “/home/swapnil/Desktop/Coursera/download.py”, line 2389, in
main()
File “/home/swapnil/Desktop/Coursera/download.py”, line 2324, in main
downloader = Downloader(config)
File “/home/swapnil/Desktop/Coursera/download.py”, line 2103, in __init__
self.login(config)
File “/home/swapnil/Desktop/Coursera/download.py”, line 2113, in login
self.opener.open(config.loginURL, formParams)
File “/usr/lib/python2.7/urllib2.py”, line 406, in open
response = meth(req, response)
File “/usr/lib/python2.7/urllib2.py”, line 519, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib/python2.7/urllib2.py”, line 444, in error
return self._call_chain(*args)
File “/usr/lib/python2.7/urllib2.py”, line 378, in _call_chain
result = func(*args)
File “/usr/lib/python2.7/urllib2.py”, line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 401: Authorization Required
Have you registered for the course that you are trying to download from? Also, are the credentials in the config file correct?
@abhiram:
i hv already registered for those courses however i am still not able to run ur script.
wat r credentials in config i.e. if it is username n passwrd den those fields r also correct.
wat could be d bug n possible solution.
swapnil@swapnil-desktop:~/Desktop/Coursera1$ python download.py
Logged into Coursera
Got all downloadable content
swapnil@swapnil-desktop:~/Desktop/Coursera1$ python download.py
Logged into Coursera
Got all downloadable content
swapnil@swapnil-desktop:~/Desktop/Coursera1$
what shud be done aftr dis caz downloading does not start.
swapnil@swapnil-desktop:~/Desktop/Coursera1$ python download.py
Logged into Coursera
Got all downloadable content
Downloading resource – https://d2bk0s8yylvsxl.cloudfront.net/stanford-compilers/resources%2Fcool_manual.pdf
Traceback (most recent call last):
File “download.py”, line 2389, in
main()
File “download.py”, line 2378, in main
downloader.download(classResource, className)
File “download.py”, line 2172, in download
r = self.opener.open(url)
File “/usr/lib/python2.7/urllib2.py”, line 400, in open
response = self._open(req, data)
File “/usr/lib/python2.7/urllib2.py”, line 418, in _open
‘_open’, req)
File “/usr/lib/python2.7/urllib2.py”, line 378, in _call_chain
result = func(*args)
File “/usr/lib/python2.7/urllib2.py”, line 1215, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File “/usr/lib/python2.7/urllib2.py”, line 1177, in do_open
raise URLError(err)
urllib2.URLError:
swapnil@swapnil-desktop:~/Desktop/Coursera1$
this messg appears aftr the command “python download.py”. it has made folders of the video but has not yet downloaded any of the video.
wat might be the problm??
Can you please paste the course link that you have used in the config file?
https://class.coursera.org/algo-2012-002/lecture/index https://class.coursera.org/compilers/lecture/index
dis are the two links i hv pasted. 1 st i juz tried with one algo link but still it din start downloading. Now from my account none f the coursera video is getting plyd
as uve given dat it makes .info file in d same folder sat thing is also absent in folder where .cfg n .py file is der
I have been downloading compilers class and it works very well for me. If you do not mind sending your coursera credentials, mail it to me at abhyrama at gmail dot com and I will try to see what is going wrong.
Thanks dude …
I think the problm is with my system n i am sending my credentials to u,plz check n tell me dat u hv received or not
thnks again..
I tried with your creds and it works for me. Are you behind a proxy? I do not think it will work behind a proxy.
i dont thin so …
i’ll try it again
@abhirama- dude i formattd my ubuntu 12.04 n installd new but the same ubuntu 12.04…
its working for me now…
thnks for the help….
dude ur work is very good..
just a random idea dat why dont u try to make a chrome extension to download coursera videos…
it would also be good for evry1
There must be an extension for chrome that lets you download all downloadable content in a page. There is one for FF.
Worked on Ubuntu, but the script bugged out on my windows machine for the HCI class.
Do you have an error trace by any chance?
I find that it is not working today, it used to work previously flawlessly. I can see the login is not happening as login page is not found.
Traceback (most recent call last):
File “download.py”, line 2400, in
main()
File “download.py”, line 2331, in main
downloader = Downloader(config)
File “download.py”, line 2106, in __init__
self.login(config)
File “download.py”, line 2116, in login
self.opener.open(config.loginURL, formParams)
File “c:\Python26\lib\urllib2.py”, line 395, in open
response = meth(req, response)
File “c:\Python26\lib\urllib2.py”, line 508, in http_response
‘http’, request, response, code, msg, hdrs)
File “c:\Python26\lib\urllib2.py”, line 433, in error
return self._call_chain(*args)
File “c:\Python26\lib\urllib2.py”, line 367, in _call_chain
result = func(*args)
File “c:\Python26\lib\urllib2.py”, line 516, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found
I have the same problem here, is there any way to fix it ?
Thanks a bunch.
I just discovered your script a couple weeks ago and have been using it ever since – apart from today, it has been working perfectly and I really appreciate your taking the time to make it public. (I’m also receiving http 404 errors and the same traceback as mohit at the moment. Haven’t had time to investigate any further.) In any case, thank you so much!
This has been fixed thanks to https://github.com/itelichko. Grab the latest download.
This works now. Thanks for you hard work and your fast reaction.
Sorry for bothering you again but I have an issue when I try to download the cryptography class. At first all goes smoothly, but then I have an error :
Traceback (most recent call last):
File “download.py”, line 2389, in
main()
File “download.py”, line 2378, in main
downloader.download(classResource, className)
File “download.py”, line 2172, in download
r = self.opener.open(url)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 400, in open
response = meth(req, response)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 513, in http_response
‘http’, request, response, code, msg, hdrs)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 438, in error
return self._call_chain(*args)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 372, in _call_chain
result = func(*args)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
Is there any way to fix it ?
Also with this class the problem is, since the teacher didn’t give names like : lecture 1-1, lecture 1-2 all the files aren’t sorted at all.
Again thanks for your job.
Looks like there is a problem with the asset itself. Try downloading the pdf of Discrete probability in week one. I am getting a forbidden error.
Have fixed taken care of this situation. Grab the latest download.
Help, I’ve been informed and I can’t become igornant.
Roligt att fototrissen kĆĀ¶r igĆĀ„ng igen. Abstinensen har jag lĆĀ¶st med ett par extra "gissa temat"-bidrag. ;-)Hoppas sommaren varit skĆĀ¶n. š
Thanks a lot, it all goes smoothly now ! Keep up the good work !
I get this error, when I want to download https://class.coursera.org/algo/lecture/index
Traceback (most recent call last):
File “download.py”, line 2405, in
main()
File “download.py”, line 2387, in main
downloader.download(classResource, className)
File “download.py”, line 2199, in download
with open(fileName, mode) as fp:
IOError: [Errno 2] No such file or directory: ‘3 – 4 – O(n log n) Algorithm for Closest Pair I [Advanced – Optional] (32 min).txt’
And the second one for https://class.coursera.org/saas-2012-002/lecture/index
Traceback (most recent call last):
File “download.py”, line 2405, in
main()
File “download.py”, line 2387, in main
downloader.download(classResource, className)
File “download.py”, line 2199, in download
with open(fileName, mode) as fp:
IOError: [Errno 2] No such file or directory: u’slides_01-BigIdeas.pdf’
perhaps because of: /slides%2Fslides_01-BigIdeas.pdf
I get syntax error. I am not familiar with python. What did i do wrong?
…\courseca>python download.py
File “download.py”, line 2175
except urllib2.HTTPError as e:
^
SyntaxError: invalid syntax
d:\Profiles\BNT467\My Documents\courseca>python
Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>>
Hi,
Got 2 different errors when downloading from 2 different sites
First Error:
Traceback (most recent call last):
File “download.py”, line 2405, in
main()
File “download.py”, line 2387, in main
downloader.download(classResource, className)
File “download.py”, line 2199, in download
with open(fileName, mode) as fp:
IOError: [Errno 2] No such file or directory: ‘2 – 2 – 1.1, 1.2 – Introduction –
Engineering Software is Different from Engineering Hardware (846).txt’
Second Error:
Traceback (most recent call last):
File “download.py”, line 2405, in
main()
File “download.py”, line 2370, in main
os.makedirs(className)
File “C:\Python27\lib\os.py”, line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect: u’Image Processing ||’
Great script. However…
I was NOT able to download this class: https://class.coursera.org/algs4partI-2012-001/class/index
As a sanity check, this course DID work for me: https://class.coursera.org/algo-2012-002/lecture/index
Hi, great work ā thanks. I have successfully used it for some of courses, but it fails on Algorithms I and Gamification. There are no exceptions or errors reported, it just says that it got all downloadable content and exits ā but hasnāt actually downloaded anything.
Sorry, please ignore — problem existed between keyboard and chair š
Worked perfect, but now I am getting a 430 Forbidden error.
Yep, same here since this morning… It fails on https://www.coursera.org/maestro/api/user/login
I am trying to download the “Algorithms, Part I” material and immediately get a forbidden error. Can you please take a look at this?
Fails to download…
Any idea why..?
Traceback (most recent call last):
File “download.py”, line 2394, in
main()
File “download.py”, line 2324, in main
downloader = Downloader(config)
File “download.py”, line 2103, in __init__
self.login(config)
File “download.py”, line 2113, in login
self.opener.open(config.loginURL, formParams)
File “C:\Python27\lib\urllib2.py”, line 397, in open
response = meth(req, response)
File “C:\Python27\lib\urllib2.py”, line 510, in http_response
‘http’, request, response, code, msg, hdrs)
File “C:\Python27\lib\urllib2.py”, line 435, in error
return self._call_chain(*args)
File “C:\Python27\lib\urllib2.py”, line 369, in _call_chain
result = func(*args)
File “C:\Python27\lib\urllib2.py”, line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: FORBIDDEN
Any updates on this? Looks like the user api has changed.
I am getting same error as krishna for all courses. š¦ Can you please fix?? š¦
May you please give a step by step procedure? I don’t know anything about programming. thanks
The login API of coursera has changed. See
https://github.com/dgorissen/coursera-dl/commit/fe9dd7d8fcf147692d3bf137993b424806911e17
for a sister project that already implemented a fix. Not sure whether this can be adapted to this project. And whether abhirama is willing to fix the script (would be nice though).
Fix incorporated here: https://github.com/dgorissen/coursera-dl
Thanks for making the code available. I cleaned it up, added some features and made it available as a python package: https://github.com/dgorissen/coursera-dl
Thanks for doing this, I will update my blog post to reflect this.
@dgorissen: does this work in the same way or there is different set of procedure that need to be followed to download the lecture? ‘m scared if it’ll mess with my existing lecture folder? Downloaded content would follow the same folder naming convention or did you change that too?
It works in the same way. However, I did ensure a numeric prefix always gets added the class directories to ensure the order of the directories is always chronological (otherwise it often isnt). This means that it will re-download everything in your case (but never remove anything that was not there). I suggest you simply try the script in a new test directory and see if you are happy with what it does.
@dgorissen: Thank you so much!! š By the way ‘m downloading current python lectures š and most probably I’ll also be able to tweek the code according to my need after I finish it. Thanks again to make it working. š
No probs š please do share back any changes you make.
@dgorissen: Yes I’ll definitely do if I make anything good. ‘m OpneSource lover! š
Hi:
I have troubling downloading contents from coursera.org. According to the readme.txt file, I took the following actions.:
1. Download python3.3 from http://www.python.org/ and install it
2. Extract coursera-download-master and open download.cfg with notepad, enter my username, password and class link
3.Open Python (command line) from all programs:
then navigate to the directory where you extracted download.py and download.cfg and type ‘python download.py’. and type in the following code in the python command line
>>>python download.py
4.I got an error:
File “” , line1
python download.py
SyntaxError: invalid error
(I don’t know how to use python at all, I just read some information from websites)
Thanks
I do not maintain this any more. Please check this out – https://github.com/dgorissen/coursera-dl.
Hi to all, it’s really a good for me to pay a quick visit this web page, it includes important Information.
I like the valuable info you supply on your articles. I’ll bookmark your weblog and take a look at once more right here frequently. I am moderately certain I’ll be informed lots of new stuff right right here!
Good luck for the following!
Highly descriptive post, I liked that bit. Will there be a
part 2?
I am genuinely delighted to glance at this blog posts which includes plenty of helpful data, thanks for providing such statistics.
I am really loving the theme/design of your website. Do you ever run into any internet browser compatibility
issues? A number of my blog audience have complained about my site not working correctly in Explorer but
looks great in Safari. Do you have any solutions to help fix this problem?
ļæ½… Arnold strzeliÅ byt
pod nosem, pokrÄciÅ verzekeren *Monty* gÅowÄ . Sir Roger popatrzyÅ na niego spoÅrĆ³d nagÅÄ nadziejÄ
– Widnieje coraz jeden sposĆ³b? – spytaÅ
raptownie. – Nie jestem pewny… – przy natarczywym sp.
This excellent website really has all the info I needed concerning this subject and didn’t know who to ask.
Very quickly this web page will be famous among all blogging
and site-building users, due to it’s fastidious content
Wonderful items from you, man. I have have in mind your stuff previous to and
you’re simply too wonderful. I really like what you’ve got here, certainly like
what you are stating and the way in which by which you
assert it. You make it entertaining and you continue to take
care of to stay it wise. I can’t wait to read far more from you. This is actually a wonderful website.
My brother suggested I might like this website.
He was once entirely right. This post actually made my day.
You cann’t believe simply how a lot time I had spent for this information! Thank you!
We are a bunch of volunteers and starting a new scheme in our community.
Your web site provided us with helpful info to work on. You have done an impressive activity and our whole neighborhood can be grateful to you.
how to make it work for the system behind proxy
How difficult is it to make this from scratch? Could you do one for novoed.com?
Buyer’s premiums generally range from 25 percent
to 50 percent based on the spot price of silver is more in industries as compared to gold.
If your object is rosland capital to buy gold in amount
as well as their family.
Where many of the most useful luck in our great spanking absolutely additional Gilded our reign will be gathered New Arrivel Geldbéę³sen.
Hi, Ī think your weĘsite might be having browser compatibility Ńssues.
When I look aat your blog site in OĻera, it lÖ oks fine Š¬Õ½t
when opening in Internet Explorer, it has some overlapping.
I juwt Ń”anted to giĘve you a quick heads up!
Other then that, superb Ę log!
Tiana Rawley is the title individuals use to call me and I adore it.
She functions as a transporting and receiving
officer but she’s already applied for an additional 1.
Kansas has always been my house. Base jumping is a thing that she is totally addicted
to. I am operating and maintaining a weblog here:
http://http://collegeandessay.com/
You may also use Allavsoft which can easily and batch Download Videos from Coursera to MP4, AVI, WMV etc
Or you can use a perl script at https://metacpan.org/pod/WWW::Coursera
I also have the need to download Coursera course video lectures.
Then I google searched and test so many so called Coursera Downloader.
Finally and luckily, I find Allavsoft which does works great in download all videos lectures from coursera.
Why not just give it a try?
According to my experience, it also helps to download video courses from Lynda, Udemy, Tutsplus, Digital Tutors, CruncyRoll, Pluralsight etc.
Hope it also helps for you.
FB Messenger Hack – How to hack Viber by a phone number?, WhatsApp Hacking Online Tool