Package: coursera-dl
Coursera DownloaderCoursera DownloaderIntroductionFeaturesDisclaimerInstallation instructionsRecommended installation method for all Operating SystemsAlternative ways of installing missing dependenciesAlternative installation method for Unix systemsArchLinuxInstalling dependencies on your ownDockerWindowsCreate an account with CourseraRunning the scriptResuming downloadsTroubleshootingChina issuesFound 0 sections and 0 lectures on this pageDownload timeoutsWindows: proxy supportWindows: Failed to create processSSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failureAlternative CDN forMathJax.jsReporting issuesFiling an issue/Reporting a bugFeedbackContactIntroductionCourserais arguably the leader inmassive open online courses(MOOC)
with a selection of more than 300 classes from 62 different institutionsas 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 fromTunapanda).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 thelecturespage, and then downloads
the related materials into appropriately named files and directories.Why is this helpful?  A utility likewgetcan work, but has the
following limitations: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.Using names from the syllabus page provides more informative names.Usingwgetin a for loop picks up extra videos which are not
posted/linked, and these are sometimes duplicates.Browser extensions likeDownloadThemAllis another possibility, butcoursera-dlprovides more features such as appropriately named files.This work was originally inspired in part byyoutube-dlby which
I've downloaded many other good videos such as those from Khan Academy.FeaturesSupport 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.,VLCor 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.netrcfile.Default arguments loaded fromcoursera-dl.conffile.Core functionality tested on Linux, Mac and Windows.Disclaimercoursera-dlis meant to be used only for your material that Coursera gives
you access to download.We do not encourage any use that violates theirTerms 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 instructionscoursera-dlrequires 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:Westronglyrecommend that you use a Python 3 interpreter (3.4
or later).On any operating system, ensure that the Python executable location is added
to yourPATHenvironment variable and, once you have the dependencies
installed (see next section), for abasicusage, you will need to invoke
the script from the main directory of the project and prepend it with the
wordpython.  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 withcoursera-dl.Recommended installation method for all Operating SystemsFrom a command line (preferably, from a virtual environment), simply issue
the command:pip install coursera-dlThis will downloadthe latest released versionof the program from thePython Package Index (PyPI)along withallthe 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 youdon'tinstall 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 withcoursera-dl).  Prefer
to use the option--usertopip install, if you need can.Note 2:As already mentioned, westronglyrecommend that you use a new
Python 3 interpreter (e.g., 3.4 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 usecoursera-dl, but you will have to install the
extra packagendg-httpsclient, which may involve compilation (at least on
Linux systems).Alternative ways of installing missing dependenciesWe strongly recommend that you consider installing Python packages withpip, as in it is the currentpreferred 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 usingpip, you can directly install all the
dependencies from the requirements file usingpip install -r requirements.txt.Alternative installation method for Unix systemsWe strongly recommend that you installcoursera-dland all its
dependencies in a way that doesnotinterfere with the rest of your Python
installation. This is accomplished by the creation of avirtual
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 ishighlyrecommended that you always install the latest version of the
Python interpreter that you can.ArchLinuxAUR package:coursera-dlInstalling dependencies on your ownWarning:This method is not recommended unless you have experience
working with multiple Python environments.You can use thepipprogram to install the dependencies on your own.  They
are all listed in therequirements.txtfile (and the extra dependencies
needed for development are listed in therequirements-dev.txtfile).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 isalwayswelcome) 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 therequirements.txtfile (and,requirements-dev.txtfile, if
applicable).DockerIf 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.Windowspython -m pip install coursera-dlBe 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:\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;Coursera-dl can now be run from commandline or powershell.Create an account with CourseraIf you don't already have one, create aCourseraaccount and enroll in
a class. Seehttps://www.coursera.org/coursesfor the list of classes.Running the scriptRun the script to download the materials by providing your Coursera account
credentials (e.g. email address and password or a~/.netrcfile), 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-poption. In this case you will be prompted for password  once the script is run.Without -p field:            coursera-dl -u <user> modelthinking-004
Multiple classes:            coursera-dl -u <user> -p <pass> saas historyofrock1-001 algo-2012-002
Filter by section name:      coursera-dl -u <user> -p <pass> -sf "Chapter_Four" crypto-004
Filter by lecture name:      coursera-dl -u <user> -p <pass> -lf "3.1_" ml-2012-002
Download only ppt files:     coursera-dl -u <user> -p <pass> -f "ppt" qcomp-2012-001
Use a ~/.netrc file:         coursera-dl -n -- matrix-001
Get the preview classes:     coursera-dl -n -b ni-001
Specify download path:       coursera-dl -n --path=C:\Coursera\Classes\ comnetworks-002
Display help:                coursera-dl --help

Maintain a list of classes in a dir:
  Initialize:              mkdir -p CURRENT/{class1,class2,..classN}
  Update:                  coursera-dl -n --path CURRENT `\ls CURRENT`Note:If yourlscommand is aliased to display a colorized output, you
may experience problems.  Be sure to escape thelscommand (use\ls) to
assure that no special characters get sent to the script.Note that wedosupport the New Platform ("on-demand") classes.On *nix platforms, the use of a~/.netrcfile is a good alternative to
specifying both your username (i.e., your email address) and password every
time on the command line. To use it, simply add a line like the one below to
a file named.netrcin your home directory (or theequivalent, if you
are using Windows) with contents like:machine coursera-dl login <user> password <pass>Create the file if it doesn't exist yet.  From then on, you can switch from
using-uand-pto simply callcoursera-dlwith the option-ninstead.  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).Alternatively, if you want to store your preferred parameters (which might
also include your username and password), create a file namedcoursera-dl.confwhere the script is supposed to be executed, with the following format:--username <user>
--password <pass>
--subtitle-language en,zh-CN|zh-TW
--download-quizzes
#--mathjax-cdn https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js
# more other parametersParameter which is stored in the file will be overriden if it is again specified
in your commandline scriptNote:Incoursera-dl.conf, all the parameters should not be wrapped
with quotes.Resuming downloadsIn default mode when you interrupt the download process by pressingCTRL+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--resumewhich continues your downloads from
where they stopped:coursera-dl -u <user> -p <pass> --resume sdn1-001This option can also be used with external downloaders:coursera-dl --wget -u <user> -p <pass> --resume sdn1-001Note 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 filesWON'Tbe deleted from
your disk.NOTE: If your password contains punctuation, quotes or other "funny
characters" (e.g.,<,>,#,&,|and so on), then you may have to
escape them from your shell. With bash or other Bourne-shell clones (and
probably with many other shells) one of the better ways to do so is to
enclose your password in single quotes, so that you don't run into
problems.  Seeissue #213for more information.TroubleshootingIf 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/welcomeHave you tried to clean the cached cookies/credentials with the--clear-cacheoption?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 therequirements.txtfile as described above.One can export a Netscape-style cookies file with a browser extension (1,2)
and use it with the-coption. This comes in handy
when the authentication via password is not working (the authentication
process changes now and then).If results show 0 sections, you most likely have provided invalid
credentials (username and/or password in the command line or in your.netrcfile or in yourcoursera-dl.conffile).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--previewparameter.If you get an error likeCould not find class: <CLASS_NAME>, then:Verify that the name of the course is correct. Current class
names in coursera are composed by a short course name e.g.classand
the current version of the course (a number). For example, for a
class namedclass, you would have to useclass-001,class-002etc.Second, verify that you are enrolled in the course. You won't be
able to access the course materials if you are not officially
enrolled and agreed to the honor coursevia the website.If:You get an error when using-nto specify that you want to use a.netrcfile and,You want the script to use your default netrc file and,You get a message sayingcoursera-dl: error: too few argumentsThen you should specify--as an argument after-n, that is,-n --or change the order in which you pass the arguments to the script, so that
the argument after-nbegins with an hyphen (-).  Otherwise, Python'sargparsemodule will think that what you are passing is the name of the
netrc file that you want to use. See issue #162.If your password has spaces, don't forget to write it using quotes.Have you installed the right project ?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:pip install coursera-dlChina 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
(seehttps://github.com/googlehosts/hostsfor 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--previewoption. 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_pageoption.Alternatively you may want to try this Chrome extension:https://chrome.google.com/webstore/detail/coursera-materials-downlo/ijkboagofaehocnjacacdhdcbbcpilihIf 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--ariaoption:coursera-dl -n --path . --aria2  <course-name>And put this into aria2c's configuration file~/.aria2/aria2.confto reduce
timeouts:connect-timeout=2
timeout=2
bt-stop-timeout=1Timeout 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:set HTTP_PROXY=http://host:port
set HTTPS_PROXY=http://host:portRelated discussion:#205Windows: Failed to create processInC:\Users\<user>\AppData\Local\Programs\Python\Python35-32\Scriptsor 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-scriptfrom#!c:\users\<user>\appdata\local\programs\python\python35-32\python.exeto#"!c:\users\<user>\appdata\local\programs\python\python35-32\python.exe"(add quotes). This is a known pip bug.Source:issue #500StackOverflowSSLError: [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 inYOURenvironment. To fix it, do the following:sudoapt-getinstallbuild-essentialpython-devlibssl-devlibffi-dev
pipinstall--userurllib3pyasn1ndg-httpsclientpyOpenSSLIf the error remains, try installing coursera-dl from github following this instruction:https://github.com/coursera-dl/coursera-dl#alternative-installation-method-for-unix-systemsIf you still have the problem, please read the following issues for more ideas on how to fix it:#330#377#329This is also worth reading:https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarningAlternative CDN forMathJax.jsWhen saving a course page, we enabledMathJaxrendering for math equations, by
injectingMathJax.jsin the header. The script is using a cdn service provided
bymathjax.org. However, that
url is not accessible in some countries/regions, you can provide a--mathjax-cdn <MATHJAX_CDN>parameter to specify theMathJax.jsfile that is
accessible in your region.Reporting issuesBefore reporting any issue please follow the steps below:Verify that you are running the latest version of the script, and the
recommended versions of its dependencies, see them in the filerequirements.txt.  Use the following command if in doubt:pip install --upgrade coursera-dlIf the problem persists, feel free toopen an issuein our
bugtracker, please fill the issue template withas much information as
possible.Filing an issue/Reporting a bugWhen reporting bugs againstcoursera-dl, please don't forget to include
enough information so that you can help us help you:Is the problem happening with the latest version of the script?What operating system are you using?Do you have all the recommended versions of the modules? See them in the
filerequirements.txt.What is the course that you are trying to access?What is the precise command line that you are using (feel free to hide
your username and password with asterisks, but leave all other
information untouched).What are the precise messages that you get? Please, use the--debugoption before posting the messages as a bug report. Please, copy and paste
them.  Don't reword/paraphrase the messages.FeedbackI 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.,Tunapanda3/20/2013"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 into wildcard issues with HTML,
and then.. I came across your script.  Can't tell you how many hours you've
just saved me :) If you're ever in Paris / Stockholm, it is absolutely
mandatory that I buy you a beer :)"Razvan T. 11/26/2012"Thanks a lot! :)"Viktor V. 24/04/2013ContactPlease, post bugs and issues ongithub. 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).