Script for downloading Coursera.org videos and naming them.
Script for downloading Coursera.org videos and naming them.
[Coursera][1] 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][13]. 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][14]).
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][2] can work, but has the following limitations:
wget in a for loop picks up extra videos which are not
posted/linked, and these are sometimes duplicates.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][3] by which I've downloaded many other good videos such as those from Khan Academy.
.netrc file.coursera-dl.conf file.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][20]. 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).
On any operating system, ensure that the Python executable location is added
to your PATH environment variable and, once you have the dependencies
installed (see next section), for a basic usage, you will need to invoke
the script from the main directory of the project and prepend it with the
word python. You can also use more advanced features of the program by
looking at the "Running the script" section of this document.
Note: You must already have (manually) agreed to the Honor of Code of the
particular courses that you want to use with coursera-dl.
From a command line (preferably, from a virtual environment), simply issue the command:
pip install coursera-dlThis will download [the latest released version][23] of the program from the [Python Package Index (PyPI)][22] 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:
apt-get install python3 python3-pip
pip3 install coursera-dlinstead.
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 coursera-dl). Prefer
to use the option --user to pip install, if you need can.
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.
If you must use Python 2, be sure that you have at least Python 2.7.9 (later
versions are OK).
Otherwise, you can still use coursera-dl, but you will have to install the
extra package ndg-httpsclient, which may involve compilation (at least on
Linux systems).
We strongly recommend that you consider installing Python packages with
[pip][17], as in it is the current [preferred method][18], 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 pip, you can directly install all the
dependencies from the requirements file using pip install -r requirements.txt.
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):
cd /directory/where/I/want/my/courses
virtualenv my-coursera
cd my-coursera
source bin/activate
git clone https://github.com/coursera-dl/coursera-dl
cd coursera-dl
pip install -r requirements.txt
./coursera-dl ...To further download new videos from your classes, simply perform:
cd /directory/where/I/want/my/courses/my-coursera
source bin/activate
cd coursera-dl
./coursera-dl ...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.
AUR package: coursera-dl
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:
pip install -r requirements.txt
pip install -r requirements-dev.txtThe 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:
docker run --rm -it -v \
"$(pwd):/courses" \
courseradl/courseradl -u <USER> -p <PASSWORD>Or using netrc file:
docker run --rm -it \
-v "$(pwd):/courses" -v "$HOME/.netrc:/netrc" \
courseradl/courseradl -n /netrcThe actual working dir for coursera-dl is /courses, all courses will be downloaded there if you don't specify otherwise.
python -m pip install coursera-dl
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.
Example:
C:\Python39\Scripts\;C:\Python39\;Or if you have restricted installation permissions and you've installed Python under AppData, add this to your PATH.
Example:
C:\Users\<user>\AppData\Local\Programs\Python\Python39-32\Scripts;C:\Users\<user>\AppData\Local\Programs\Python\Python39-32;Coursera-dl can now be run from commandline or powershell.
If you don't already have one, create a [Coursera][1] account and enroll in a class. See https://www.coursera.org/courses for the list of classes.
Refer to coursera-dl --help for a complete, up-to-date reference on the runtime options
supported by this utility.
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:
General: coursera-dl -u <user> -p <pass> modelthinking-004
With CAUTH parameter: coursera-dl -ca 'some-ca-value-from-browser' modelthinking-004If you don't want to type your password in command line as plain text, you can use the
script without -p option. In this case you will be prompted for password once the
script is run.
Here are some examples of how to invoke coursera-dl from the command line:
…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.
By default, videos are downloaded at 540p resolution. For on-demand courses, the
--video-resolution flag accept
Not able to authenticate and login
JSON ERROR
Coursera - API Route Does Not Exist They have upgraded to V3
Seems Like Coursera API or Authentication problem
ModuleNotFoundError: No module named 'multiprocessing'
Json Decoder Error
403 client error, Forbidden for URL
Can't download Professional Certificate course
Error logging in?
How to download these PPT from this link "https://volta.foundation/battery-report-2024"