Package: coursera_offline
Coursera OfflineDownload and save the video lectures of your favorite courses for
offline viewing.ChangesWhen-doption is given and the given directory does not exist,
exiting with error on -S option and creating the directory on -s
option.Extracting and normalizing the titles of files from urls.Now supports download of excel files.Deprecated -f option in favor of -SInstallationMake sure you have python version 2.7 installed. If you don’t have
python, get it fromhereIf you have python and are not sure of the version, typepython-Vin the terminal. If it says 2.7.x+ then you may proceed
to the next instruction. Otherwise, go to the link provided above.Installpipusingsudoapt-getinstallpython-pip. Install
the application usingsudo pip install coursera_offlineBefore proceeding to the next step, make sure you havesetuptoolsmodule installed. If it isn’t, you can find the installation
instructionshere.If you don’t want to install pip, you can download the tar.gz fromPyPior zip fromGithub,
extract the archive file and follow the installation instructions in
the README.txt file.You may also clone the repo onto your local workstation and follow
the instructions in the README.txt filegit clonehttps://github.com/sanketh95/coursera-offlineFor those behind proxyYou just need to setHTTP_PROXYandHTTPS_PROXYenvironment
variables and python automatically sends all requests through proxy.
Here’s the way to set proxy in windows and linuxWindowsRunsetHTTP_PROXY=http://user:password@address:portandsetHTTPS_PROXY=https://user:password@address:portLinuxRunexportHTTP_PROXY=http://user:password@address:portandexportHTTPS_PROXY=https://user:password@address:portREQUIRESPython2.7pyquery 1.2.9crontab 1.8.1Note:You need not install the requirements manually, the setup
script takes care of installing them for you.RunningWindowsOpen command prompt and change thecdinto the directory
containingcoursera-offlineand runpython coursera_offline-hLinuxOpen terminal and runcoursera_offline-h.FeaturesAll the videos are downloaded according to the folder structure and
you don’t need to take care of sorting the videos into separate
folders manually.You need not track the order of the videos/weeks as the script
intentionally renames them so that the week and video order
maintained.The downloads are lightning fast as the videos are downloaded
parallely.The script creates a crontab entry automatically to fetch any newly
added videos in the course. You can also force synch with Coursera
just by running a simple command.The script also downloads the subtitles automatically and saves them
inSubsfolder. So when you play the videos using VLC, the subs are
automatically loaded.The script saves adata.jsonfile in the course directory. This has
all the information required to fetch the videos. So even if you lose
some videos or if you forget the course name, as long as you have thedata.jsonfile, you can always re-download the lost videos.The script saves the session cookies so you don’t have to login
everytime you run it.The script fetches the lecture slides (pdfs and ppts) and saves them
in ‘Other Files’ folder.Full Usageusage: coursera_offline.py [-h] [-s SHORTNAME] [-e EMAIL] [-p PASSWORD] [-S]
                           [-d DIR] [-a [AUTO]]

optional arguments:
  -h, --help            show this help message and exit
  -s SHORTNAME, --shortname SHORTNAME
                        Short name of the course being downloaded. This option
                        is required when running the script for the first time
  -e EMAIL, --email EMAIL
                        Email id registered with Coursera
  -p PASSWORD, --password PASSWORD
                        Coursera Password
  -S, --synch           Give this flag to synch with Coursera
  -d DIR, --dir DIR     Give this option to save the videos in the path
                        specified as argument. Defaults to Present Working
                        Directory (PWD).
  -a [AUTO], --auto [AUTO]
                        Give this option to create a crontab entry inorder to
                        automatically synch with Coursera. Argument must one
                        among 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'.
                        The argument is optional and defaults to 'SUN'Some sample invocationsNote:In order to download some courses, you need to register to the
course and accept the honor code in Coursera site before running the
script.Let’s say you’re downloading a course calledIntroduction to Logicand you want to download it to the~/Logicdirectory.First time downloadcoursera_offline -d ~/Logic -s intrologic-005 -e <email> -p <password>Do this to download the video lectures arranged as per weeks. This
creates theLogicdirectory in the home directory (if it doesn’t
exist) and downloads all the videos into this directory. This also
creates adata.jsonfile that contains all the information requried
to download the videos.The argumentintrologic-005is called theshortnameand is
unique for every course. It can be obtained from the class url. For
example for the course under discussion, the url ishttps://class.coursera.org/intrologic-005.Obtaining the shortnameSignin to Coursera fromhere.You’ll be redirected to a page containing all your registered
courses.Choose the course you want to download and click theGo to classbutton.You’ll be redirected to the class page whose url looks likehttps://class.coursera.org/<shortname>.Copy the short name.Note:If the-doptions is not given, the videos will be
downloaded to the current working directory.Synchingcoursera_offline -d ~/Logic -S -e <email> -p <password>Okay, so you’ve been a few weeks into the course, now u need to fetch
the updated videos. Don’t worry, there’s a way to do it ! The above
command takes care of fetching the updated video content and synching it
with your local directories.Auto Synchcoursera_offline -a <Day of the week> -s intrologic-005 -e <email> -p <password>You’re downloading the course for the first time, and you don’t want to
keep using the ‘Synch’ command whenever you want to update the video
content, you can just pass the-aflag which creates a crontab entry
for the Synch command whch will be run at 11:59:59 pm on that particular
day of the week. If no day is specified, it is defaulted toSunday.Note:You can still force the script to synch with Coursera by using
the Synch command described above.