How to download videos from coursera
How to download videos from coursera
How to download all contents in Coursera courses automatically.
This article is just a memo for me that remind me of how to download Coursera contents, such as videos and scripts, to my own computer using coursera-dl.
Setup coursera-dl.
Python environment is required, but even windows is OK for using this tool.
Simply, You can install via typing the command below.
This is a one of many options of installation. If you need another option, please check it’s README in Github.
Create coursera-dl.conf file.
Place the file namely ‘coursera-dl.conf’ in the directory where to use coursera-dl command.
The example of the format is below.
Execute a command and trouble shooting.
Now, you can use coursera-dl.
You can get the course name in the url of the course you would like to get contents.
For example, if you would like to get the contents in a course below,
you should type the command below.
Then, coursera-dl starts downloading. In the end, you can see like the file structure like below images.
And Importantly, please note that when you use coursera-dl command, coursera-dl might get error with “400 Bad request” at the coursera authentication process.
To get avoid this, We need a pache mentioned in this comment and need a cookies.txt of coursera.
Please reference the comment in the github issue.
coursera-dl 0.11.5
pip install coursera-dl Copy PIP instructions
Released: Dec 16, 2019
Script for downloading Coursera.org videos and naming them.
Navigation
Project links
Statistics
View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery
License: GNU Lesser General Public License v3 or later (LGPLv3+) (LGPL)
Tags coursera-dl, coursera, download, education, MOOCs, video
Maintainers
Classifiers
Project description
Coursera Downloader
Introduction
Coursera 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 coursera-dl provides more features such as appropriately named files.
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
coursera-dl is meant to be used only for your material that Coursera gives you access to download.
We do not encourage any use that violates their Terms Of Use. A relevant excerpt:
«[. ] Coursera grants you a personal, non-exclusive, non-transferable license to access and use the Sites. You may download material from the Sites only for your own personal, non-commercial use. You may not otherwise copy, reproduce, retransmit, distribute, publish, commercially exploit or otherwise transfer any material, nor may you modify or create derivatives works of the material.»
Installation instructions
coursera-dl requires Python 2 or Python 3 and a free Coursera account enrolled in the class of interest. (As of February of 2016, we test automatically the execution of the program with Python versions 2.6, 2.7, Pypy, 3.4, 3.5, and 3.6).
Note: We strongly recommend that you use a Python 3 interpreter (3.4 or later).
Recommended installation method for all Operating Systems
From 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:
Alternative ways of installing missing dependencies
Alternative installation method for Unix systems
We strongly recommend that you install coursera-dl and all its dependencies in a way that does not interfere with the rest of your Python installation. This is accomplished by the creation of a virtual environment, or «virtualenv».
For the initial setup, in a Unix-like operating system, please use the following steps (create/adapt first the directory /directory/where/I/want/my/courses ):
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.
ArchLinux
Installing dependencies on your own
Warning: This method is not recommended unless you have experience working with multiple Python environments.
You can use the pip program to install the dependencies on your own. They are all listed in the requirements.txt file (and the extra dependencies needed for development are listed in the requirements-dev.txt file).
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 requirements.txt file (and, requirements-dev.txt file, if applicable).
Docker
If 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 Coursera
If 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 script
Run the script to download the materials by providing your Coursera account credentials (e.g. email address and password or a
/.netrc file), the class names, as well as any additional parameters:
Note: If your ls command is aliased to display a colorized output, you may experience problems. Be sure to escape the ls command (use \ls ) to assure that no special characters get sent to the script.
Note that we do support the New Platform («on-demand») classes.
On *nix platforms, the use of a
Alternatively, if you want to store your preferred parameters (which might also include your username and password), create a file named coursera-dl.conf where the script is supposed to be executed, with the following format:
Parameter which is stored in the file will be overriden if it is again specified in your commandline script
Resuming downloads
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.
Troubleshooting
If you have problems when downloading class materials, please try to see if one of the following actions solve your problem:
Make sure the class name you are using corresponds to the resource name used in the URL for that class: https://www.coursera.org/learn/ /home/welcome
Note that many courses (most, perhaps?) may remove the materials after a little while after the course is completed, while other courses may retain the materials up to a next session/offering of the same course (to avoid problems with academic dishonesty, apparently).
In short, it is not guaranteed that you will be able to download after the course is finished and this is, unfortunately, nothing that we can help you with.
Make sure you have installed and/or updated all of your dependencies according to the requirements.txt file as described above.
You want the script to use your default netrc file and,
You get a message saying coursera-dl: error: too few arguments
If your password has spaces, don’t forget to write it using quotes.
Warning: If you installed the script using PyPi (pip) please verify that you installed the correct project. We had to use a different name in pip because our original name was already taken. Remember to install it using:
China issues
If 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 page
First of all, make sure you are enrolled to the course you want to download.
If none of the above works for you, there is nothing we can do.
Download timeouts
And put this into aria2c’s configuration file
/.aria2/aria2.conf to reduce timeouts:
Timeout configuration for internal downloader is not supported.
Windows: proxy support
If you’re on Windows behind a proxy, set up the environment variables before running the script as follows:
Windows: Failed to create process
In C:\Users\ \AppData\Local\Programs\Python\Python35-32\Scripts or wherever Python installed (above is default for Windows) edit below file in idle: (right click on script name and select ‘edit with idle in menu)
(add quotes). This is a known pip bug.
SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
This is a known error, please do not report about this error message! The problem is in YOUR environment. To fix it, do the following:
If you still have the problem, please read the following issues for more ideas on how to fix it: #330 #377 #329
Alternative CDN for MathJax.js
Reporting issues
Before reporting any issue please follow the steps below:
If the problem persists, feel free to open an issue in our bugtracker, please fill the issue template with as much information as possible.
Filing an issue/Reporting a bug
Feedback
I enjoy getting feedback. Here are a few of the comments I’ve received:
«Thanks for the good job! Knowledge will flood the World a little more thanks to your script!»
Guillaume V. 11/8/2012
«Just wanted to send you props for your Python script to download Coursera courses. I’ve been using it in Kenya for my non-profit to get online courses to places where internet is really expensive and unreliable. Mostly kids here can’t afford high school, and downloading one of these classes by the usual means would cost more than the average family earns in one week. Thanks!»
Jay L., Tunapanda 3/20/2013
«Thanks a lot! :)»
Viktor V. 24/04/2013
rahgurung/coursera-HD-video-downloader
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Coursera HD Video Downloader
Right now, an issue with video downloads of Coursera is that it doesn’t allows to download videos in HD. This extension resolves that issue by providing the video download in best quality available.
To run a development server that will watch for file changes and rebuild the scripts, run:
To just build the files without the development server:
Both commands will create a dist/ directory, it will contain the built files that should be loaded into the browser or packed.
coursera-dl/coursera-dl
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Coursera 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 coursera-dl provides more features such as appropriately named files.
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.
coursera-dl is meant to be used only for your material that Coursera gives you access to download.
We do not encourage any use that violates their Terms Of Use. A relevant excerpt:
«[. ] Coursera grants you a personal, non-exclusive, non-transferable license to access and use the Sites. You may download material from the Sites only for your own personal, non-commercial use. You may not otherwise copy, reproduce, retransmit, distribute, publish, commercially exploit or otherwise transfer any material, nor may you modify or create derivatives works of the material.»
coursera-dl requires Python 2 or Python 3 and a free Coursera account enrolled in the class of interest. (As of February of 2020, we test automatically the execution of the program with Python versions 2.7, Pypy, 3.6, 3.7, 3.8, and 3.9).
Note: We strongly recommend that you use a Python 3 interpreter (3.9 or later).
Recommended installation method for all Operating Systems
From 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:
Alternative ways of installing missing dependencies
Alternative installation method for Unix systems
We strongly recommend that you install coursera-dl and all its dependencies in a way that does not interfere with the rest of your Python installation. This is accomplished by the creation of a virtual environment, or «virtualenv».
For the initial setup, in a Unix-like operating system, please use the following steps (create/adapt first the directory /directory/where/I/want/my/courses ):
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.
Installing dependencies on your own
Warning: This method is not recommended unless you have experience working with multiple Python environments.
You can use the pip program to install the dependencies on your own. They are all listed in the requirements.txt file (and the extra dependencies needed for development are listed in the requirements-dev.txt file).
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 requirements.txt file (and, requirements-dev.txt file, if applicable).
If 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.
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 Coursera
If 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 script
Run the script to download the materials by providing your Coursera account credentials (e.g. email address and password or a
/.netrc file), the class names, as well as any additional parameters:
Here are some examples of how to invoke coursera-dl from the command line:
-f «ppt» qcomp-2012-001 Use a
Note: If your ls command is aliased to display a colorized output, you may experience problems. Be sure to escape the ls command (use \ls ) to assure that no special characters get sent to the script.
Note that we do support the New Platform («on-demand») courses.
On *nix platforms, the use of a
Alternatively, if you want to store your preferred parameters (which might also include your username and password), create a file named coursera-dl.conf where the script is supposed to be executed, with the following format:
Parameters which are specified in the file will be overriden if they are provided again on the commandline.
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.
If you have problems when downloading class materials, please try to see if one of the following actions solve your problem:
Make sure the class name you are using corresponds to the resource name used in the URL for that class: https://www.coursera.org/learn/ /home/welcome
Note that many courses (most, perhaps?) may remove the materials after a little while after the course is completed, while other courses may retain the materials up to a next session/offering of the same course (to avoid problems with academic dishonesty, apparently).
In short, it is not guaranteed that you will be able to download after the course is finished and this is, unfortunately, nothing that we can help you with.
Make sure you have installed and/or updated all of your dependencies according to the requirements.txt file as described above.
You want the script to use your default netrc file and,
You get a message saying coursera-dl: error: too few arguments
If your password has spaces, don’t forget to write it using quotes.
Warning: If you installed the script using PyPi (pip) please verify that you installed the correct project. We had to use a different name in pip because our original name was already taken. Remember to install it using:
If 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 page
First of all, make sure you are enrolled to the course you want to download.
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.
And put this into aria2c’s configuration file
/.aria2/aria2.conf to reduce timeouts:
Timeout configuration for internal downloader is not supported.
Windows: proxy support
If you’re on Windows behind a proxy, set up the environment variables before running the script as follows:
Windows: Failed to create process
In C:\Users\ \AppData\Local\Programs\Python\Python39-32\Scripts or wherever Python installed (above is default for Windows) edit below file in idle: (right click on script name and select ‘edit with idle in menu)
(add quotes). This is a known pip bug.
SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
This is a known error, please do not report about this error message! The problem is in YOUR environment. To fix it, do the following:
If you still have the problem, please read the following issues for more ideas on how to fix it: #330 #377 #329
Alternative CDN for MathJax.js
Before reporting any issue please follow the steps below:
If the problem persists, feel free to open an issue in our bugtracker, please fill the issue template with as much information as possible.
Filing an issue/Reporting a bug
I enjoy getting feedback. Here are a few of the comments I’ve received:
«Thanks for the good job! Knowledge will flood the World a little more thanks to your script!»
Guillaume V. 11/8/2012
«Just wanted to send you props for your Python script to download Coursera courses. I’ve been using it in Kenya for my non-profit to get online courses to places where internet is really expensive and unreliable. Mostly kids here can’t afford high school, and downloading one of these classes by the usual means would cost more than the average family earns in one week. Thanks!»
Jay L., Tunapanda 3/20/2013
«Thanks a lot! :)»
Viktor V. 24/04/2013
Please, 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.
coursera-dl/edx-dl
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
edx-dl is a simple tool to download videos and lecture materials from Open edX-based sites. It requires a Python interpreter (>= 2.7) and very few other dependencies. It is platform independent, and should work fine under Unix (Linux, BSDs etc.), Windows or Mac OS X.
We strongly recommend that, if you don’t already have a Python interpreter installed, that you install Python >= 3.6, if possible, since it is better in general.
To install edx-dl run:
To install all the dependencies please do:
From there, choose the course you are interested in, copy its URL and use it in the following command:
replacing COURSE_URL with the URL that you just copied in the first step. It should look something like: https://courses.edx.org/courses/edX/DemoX.1/2014/info
To see all available options and a brief description of what they do, simply execute:
You can run this application via Docker if you want. Just install docker and run
Before reporting any issue please follow the steps below:
Verify that you are running the latest version of all the programs (both of edx-dl and of youtube-dl ). Use the following command if in doubt:
If the problem persists, feel free to open an issue in our bugtracker, please fill the issue template with as much information as possible.
These are the current supported sites:
This is the full list of sites powered by Open edX. Not all of them are supported at the moment, we welcome you to contribute support for them and send a pull request also via our issue tracker.