/coursera

Script for downloading Coursera.org videos and naming them.

Primary LanguagePython

Coursera Downloader
-------------------

Coursera (http://coursera.org) is creating some fantastic, free educational
videos. This script allows one to batch download videos for a Coursera class.
Given a class name and related cookie file, it scrapes the course listing page
to get the week and class names, and then downloads the related videos into
appropriately named files and directories.  

Why is this helpful?  Before I was using wget, but I had the following problems:

  1. Video names have a number in them, but this does not correspond to the
     actual order.  Manually renaming them is a pain.
  2. Using names from the syllabus page provides more informative names.
  3. Using a wget in a forloop picks up extra videos which are not posted/linked,
     and these are sometimes duplicates.

Naming is somewhat verbose, so that it will display and sort properly using MX
Video on my Andriod phone.

Inspired in part by youtube-dl (http://rg3.github.com/youtube-dl) by which I've
downloaded many other good videos such those from Khan Academy.  


Directions
----------

Requires Python 2.x (where x >= 5) and a free Coursera account.

1. Install any missing dependencies.

  1a. Beautiful Soup 3 -- http://www.crummy.com/software/BeautifulSoup/
    Ubuntu/Debian: sudo apt-get install python-beautifulsoup 
    Other*: easy_install BeautifulSoup

  1b.  Argparse -- http://pypi.python.org/pypi/argparse
    (Not necessary if Python version >= 2.7)
    Ubuntu/Debian: sudo apt-get install python-argparse
    Other*: easy_install argparse

  * To install "easy_install"
    Ubuntu: sudo apt-get install python-setuptools
    Windows: http://pypi.python.org/pypi/setuptools

2. Create a Coursera.org account and login.
    e.g. http://saas-class.org

3. Locate or export your Netscape-style cookies file with a browser extension.
    Chrome: Cookie.txt Export
      https://chrome.google.com/webstore/detail/lopabhfecdfhgogdbojmaicoicjekelh
    Firefox: Export Cookies 1.2
      https://addons.mozilla.org/en-US/firefox/addon/export-cookies/

4. Run the script to download the videos.
    e.g. coursera-dl -c cookies.txt saas

Tested on:
  - Ubuntu/Python 2.6.5
  - Win7/Python2.5 (Cygwin)


Troubleshooting
---------------

If it's finding 0 sections, you probably have a bad cookies file.
Use -l listing.html and then examine that file -- if it's the non-logged-in
page then this is definitely your problem.

Examples:
  coursera-dl -c cookies.txt saas
  coursera-dl -c cookies.txt -l listing.html -o saas --skip-download


Contact
-------
Send any questions, comments, or problems to:
  John Lehmann: first last at geemail dotcom or @jplehmann