Beruflich Dokumente
Kultur Dokumente
Code Issues
89 Pull requests
9 Projects
0 Wiki Insights
Branch:
master
coursera-dl / README.md
Find file Copy path
Copy path
balta2ar
Add China issues section in Troubleshooting 0ec9805
on Aug 27, 2017
29
contributors and
andothers
others
Coursera Downloader
Introduction
Features
Disclaimer
Installation instructions
Recommended installation method for all Operating Systems
Alternative ways of installing missing dependencies
Alternative installation method for Unix systems
Installing dependencies on your own
Windows
Create an account with Coursera
Running the script
Resuming downloads
Troubleshooting
China issues
Found 0 sections and 0 lectures on this page
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:
1. Video names have numbers in them, but this does not correspond to
the actual order. Manually renaming them is a pain that is
best left
for computers.
2. Using names from the syllabus page provides more informative names.
3. Using wget in a for loop picks up extra videos which are not
posted/linked, and these are sometimes duplicates.
Features
Support for all kinds of courses (i.e., "Old Platform"/time-based as
well as "New Platform"/on-demand courses).
Intentionally detailed names, so that it will display and sort properly
on most interfaces (e.g., VLC or MX Video on Android
devices).
Regex-based section (week) and lecture name filters to download only
certain resources.
File format extension filter to grab resource types you want.
Login credentials accepted on command-line or from .netrc file.
Default arguments loaded from coursera-dl.conf file.
Core functionality tested on Linux, Mac and Windows.
Disclaimer
coursera-dl is meant to be used only for your material that Coursera gives
you access to download.
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.2, 3.3, 3.4, and 3.5).
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 .
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.
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 ...
cd /directory/where/I/want/my/courses/my-coursera
source bin/activate
cd coursera-dl
./coursera-dl ...
ArchLinux
AUR package: coursera-dl
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).
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).
Windows
Be sure that the Python install path is added to the PATH system environment variables. This can be found in Control Panel > System
Example:
C:\Python35\Scripts\;C:\Python35\;
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\Python35-32\Scripts;C:\Users\
<user>\AppData\Local\Programs\Python\Python35-32;
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.
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:
Create the file if it doesn't exist yet. From then on, you can switch from
using -u and -p to simply call coursera-dl with the
option -n
instead. This is especially convenient, as typing usernames (email
addresses) and passwords directly on the command line
can get tiresome (even
more if you happened to choose a "strong" password).
named coursera-dl.conf
where the script is supposed to be executed, with the following format:
--username <user>
--password <pass>
--subtitle-language en,zh-CN|zh-TW
--download-quizzes True
#--mathjax-cdn https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js
# more other parameters
Resuming downloads
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/<CLASS_NAME>/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.
One can export a Netscape-style cookies file with a browser extension (1, 2)
and use it with the -c option. This comes in handy
when the authentication via password is not working (the authentication
process changes now and then).
For courses that have not started yet, but have had a previous iteration
sometimes a preview is available, containing all the
classes from the last
course. These files can be downloaded by passing the --preview
parameter.
If you get an error like Could not find class: <CLASS_NAME> , then:
If:
You get an error when using -n to specify that you want to use a
.netrc file and,
You want the script to use your default netrc file and,
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.246.72 d3c33hcgiwev3.cloudfront.net" in the
hosts file
(/etc/hosts) and freshing DNS with "ipconfig/flushdns" may work
(see this comment).
First 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 --preview option.
Some
courses allow to download lecture materials without enrolling, but
it's not common and is not guaranteed to work for every
course.
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 --process_local_page
option.
If none of the above works for you, there is nothing we can do.
set HTTP_PROXY=http://host:port
set HTTPS_PROXY=http://host:port
In C:\Users\<user>\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)
coursera-dl-script
from
#!c:\users\<user>\appdata\local\programs\python\python35-32\python.exe
to
#"!c:\users\<user>\appdata\local\programs\python\python35-32\python.exe"
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 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
When saving a course page, we enabled MathJax rendering for math equations, by
injecting MathJax.js in the header. The script
is using a cdn service provided
by mathjax.org. However, that
url is not accessible in some countries/regions, you can provide a
--
mathjax-cdn <MATHJAX_CDN> parameter to specify the MathJax.js file that is
accessible in your region.
Reporting issues
Before reporting any issue please follow the steps below:
1. Verify that you are running the latest version of the script, and the
recommended versions of its dependencies, see them in the
file
requirements.txt . Use the following command if in doubt:
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!"
"I am a big fan of Coursera and attend lots of different courses. Time
constraints don't allow me to attend all the courses I want
at the same time.
I came across your script, and I am very happily using it! Great stuff and
thanks for making this available on
Github - well done!"
William G. 2/18/2013
"This script is awesome! I was painstakingly downloading each and every video
and ppt by hand -- looked into wget but ran
Razvan T. 11/26/2012
Viktor V. 24/04/2013
Contact
Please, post bugs and issues on github. Send other comments to Rogério
Theodoro de Brito (the current maintainer):
rbrito@ime.usp.br (twitter:
@rtdbrito) or to John Lehmann (the original author): first last at
geemail dotcom (twitter: @jplehmann).
© 2018 GitHub, Inc. Terms Privacy Security Status Help Contact GitHub API Training Shop Blog About