Show
IntroductionCoursera is arguably the leader in massive open online courses (MOOC) with a selection of more than 300 classes from 62 different institutions as of February 2013. Generous contributions by educators and institutions are making excellent education available to many who could not afford it otherwise. There are even non-profits with "feet on the ground" in remote areas of the world who are helping spread the wealth (see the feedback below from Tunapanda). This script makes it easier to batch download lecture resources (e.g., videos, ppt, etc) for Coursera classes. Given one or more class names and account credentials, it obtains week and class names from the lectures page, and then downloads the related materials into appropriately named files and directories. Why is this helpful? A utility like wget can work, but has the following limitations:
Browser extensions like DownloadThemAll is another possibility, but This work was originally inspired in part by youtube-dl by which I've downloaded many other good videos such as those from Khan Academy. Features
Disclaimer
We do not encourage any use that violates their Terms Of Use. A relevant excerpt:
Installation instructions
Note: We strongly recommend that you use a Python 3 interpreter (3.9 or later). On any operating system, ensure that the Python executable location is added to your Note: You must already have (manually) agreed to the Honor of Code of the particular courses that you want to use with Recommended installation method for all Operating SystemsFrom a command line (preferably, from a virtual environment), simply issue the command: This will download the latest released version of the program from the Python Package Index (PyPI) along with all the necessary dependencies. At this point, you should be ready to start using it. If this does not work, because your Python 2 version is too old (e.g. 2.7.5 on Ubuntu 14.4), try:
instead. Note 1: We strongly recommend that you don't install the package globally on your machine (i.e., with root/administrator privileges), as the installed modules may conflict with other Python applications that you have installed in your system (or they can interfere with Note 2: As already mentioned, we strongly recommend that you use a new Python 3 interpreter (e.g., 3.9 or later), since Python 3 has better support for SSL/TLS (for secure connections) than earlier versions. Alternative ways of installing missing dependenciesWe strongly recommend that you consider installing Python packages with pip, as in it is the current preferred method, unless directed otherwise by one of the project members (for
instance, when testing or debugging a new feature or using the source code directly from our git repository). If you are using Alternative installation method for Unix systemsWe strongly recommend that you install For the initial setup, in a Unix-like operating system, please use the following steps (create/adapt first the directory
To further download new videos from your classes, simply perform:
We are working on streamlining this whole process so that it is as simple as possible, but to support older versions of Python and to cope with Coursera disabling SSLv3, we have to take a few extra steps. In any case, it is highly recommended that you always install the latest version of the Python interpreter that you can. ArchLinuxAUR package: coursera-dl Installing dependencies on your ownWarning: This method is not recommended unless you have experience working with multiple Python environments. You can use the To use this method, you would proceed as:
The second line above should only be needed if you intend to help with development (and help is always welcome) or if a maintainer of the project asks you to install extra packages for debugging purposes. Once again, before filing bug reports, if you installed the dependencies on your own, please check that the versions of your modules are at least those listed in the DockerIf you prefer you can run this software inside Docker:
Or using netrc file:
The actual working dir for coursera-dl is /courses, all courses will be downloaded there if you don't specify otherwise. Windows
Be sure that the Python install path is added to the PATH system environment variables. This can be found in Control Panel > System > Advanced System Settings > Environment Variables.
Or if you have restricted installation permissions and you've installed Python under AppData, add this to your PATH.
Coursera-dl can now be run from commandline or powershell. Create an account with CourseraIf you don't already have one, create a Coursera account and enroll in a class. See https://www.coursera.org/courses for the list of classes. Running the scriptRefer to Run the script to download the materials by providing your Coursera account credentials (e.g. email address and password or a
If you don't want to type your password in command line as plain text, you can use the script without Here are some examples of how to invoke
Note: If your Note that we do support the New Platform ("on-demand") courses. By default, videos are downloaded at 540p resolution. For on-demand courses, the To download just the On *nix platforms, the use of a
Create the file if it doesn't exist yet. From then on, you can switch from using Alternatively, if you want to store your preferred parameters (which might
also include your username and password), create a file named
Parameters which are specified in the file will be overriden if they are provided again on the commandline. Note: In Resuming downloadsIn default mode when you interrupt the download process by pressing CTRL+C, partially downloaded files will be deleted from your disk and you have to start the download process from the beginning. If your download was interrupted by something other than KeyboardInterrupt (CTRL+C)
like sudden system crash, partially downloaded files will remain on your disk and the next time you start the process again, these files will be discarded from download list!, therefore it's your job to delete them manually before next start. For this reason we added an option called
This option can also be used with external downloaders:
Note 1: Some external downloaders use their own built-in resume feature which may not be compatible with others, so use them at your own risk. Note 2: Remember that in resume mode, interrupted files WON'T be deleted from your disk. NOTE: If your
password contains punctuation, quotes or other "funny characters" (e.g., TroubleshootingIf you have problems when downloading class materials, please try to see if one of the following actions solve your problem:
China issuesIf you are from China and you're having problems downloading videos, adding "52.84.167.78 d3c33hcgiwev3.cloudfront.net" in the hosts file (/etc/hosts) and freshing DNS with "ipconfig/flushdns" may work (see https://github.com/googlehosts/hosts for more info). Found 0 sections and 0 lectures on this pageFirst of all, make sure you are enrolled to the course you want to download. Many old courses have already closed enrollment
so often it's not an option. In this case, try downloading with Finally, you can download the videos if you have, at least, the index file that lists all the course materials. Maybe your friend who is enrolled could save that course page for you. In that case use the Alternatively you may want to try this various browser extensions designed for this problem. If none of the above works for you, there is nothing we can do. Download timeoutsCoursera-dl supports external downloaders but note that they are only used to download materials after the syllabus has been parsed, e.g. videos, PDFs, some handouts and additional files (syllabus is always downloaded using the internal downloader). If you experience problems with downloading such
materials, you may want to start using external downloader and configure its timeout values. For example, you can use aria2c downloader by passing
And put this into aria2c's configuration file
Timeout configuration for internal downloader is not supported. Windows: proxy supportIf you're on Windows behind a proxy, set up the environment variables before running the script as follows:
Related discussion: #205 Windows: Failed to create processIn from
to
(add quotes). This is a known pip bug. Source: issue #500 StackOverflow SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failureThis is a known error, please do not report about this error message! The problem is in YOUR environment. To fix it, do the following: sudo apt-get install build-essential python-dev libssl-dev libffi-dev pip install --user urllib3 pyasn1 ndg-httpsclient pyOpenSSL If the error remains, try installing coursera-dl from github following this instruction: https://github.com/coursera-dl/coursera-dl#alternative-installation-method-for-unix-systems If you still have the problem, please read the following issues for more ideas on how to fix it: #330 #377 #329 This is also worth reading: https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning Alternative CDN for MathJax.jsWhen
saving a course page, we enabled Reporting issuesBefore reporting any issue please follow the steps below:
Filing an issue/Reporting a bugWhen reporting bugs against
FeedbackI enjoy getting feedback. Here are a few of the comments I've received:
ContactPlease, post bugs and issues on github. Please, DON'T send support requests privately to the maintainers! We are quite swamped with day-to-day activities. If you have problems, PLEASE, file them on the issue tracker. |