Download Stanford Online Courses From Command Line
Howdy! I’ve got a good news for students and online educators. Stanford Engineering Everywhere (SEE), an initiative started by Andrew Ng at Stanford University, offers a number of Stanford online courses for completely free. All you need is a System with an Internet connection. Everyone can freely access full course materials including syllabus, handouts, homework, and exams at no cost, from anywhere using their systems and mobile devices. All course materials can be downloaded from the respective course page. If you are a Linux user, you can now download them from command line. A fellow Linux user has created a simple script called “stanford-dl” to download course videos and/or pdfs from Stanford Engineering Everywhere website.
The “stanford-dl” script us written using “Go” programming language, so you need to install Go language in your system. Refer the below link to install GO language in various Linux distributions.
After installing Go language, run the following command to install stanford-dl:
$ go get github.com/coderick14/stanford-dl
Alternatively, you can download it from the official releases page.
$ wget https://github.com/coderick14/stanford-dl/releases/download/v1.0/linuxAMD64.zip
Extract the downloaded zip file:
$ unzip linuxAMD64.zip
Then, you can run it at any time using below command:
Download Stanford Courses From Command Line
Usage is not a big deal.
To download all transcripts (PDFs) for a given course, say CS229, run:
$ stanford-dl --course CS229 --type pdf --all
Here, CS229 is the code name of “Machine Learning” course. All course codes can be viewed in the SSE’s Courses section. It would be much better if we can able to view the course code from the command line. I had to go to the course page each time to find its code.
Please note that you don’t need to mention “–type pdf” option as stanford-dl script downloads the PDFs by default.
For example, the following command will download all PDFs for Machine learning course.
$ stanford-dl --course CS229 --all
To download only certain lectures, for example lecture 1, 10, and 20, run:
$ stanford-dl --course CS229 --type pdf --lec 1,10, 20
To download all videos for the given course:
$ stanford-dl --course CS229 --type video --all
Download only certain lectures:
$ stanford-dl --course CS229 --type video --lec 1,10,20
To view the help section, type:
$ stanford-dl -h
Usage of ./stanford-dl: -all Download material for all lectures for the given course -course string Course name e.g. CS229, EE261 -help Display help -lec string Specify comma separated list of lectures e.g 1,3,10 -type string . Defaults to pdf. (default "pdf")
This script has only the basic functionalities and it is used to be strictly for the educational purposes.