Skip to content

Instantly share code, notes, and snippets.

@nevalsar
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevalsar/f78913463dc59746c794 to your computer and use it in GitHub Desktop.
Save nevalsar/f78913463dc59746c794 to your computer and use it in GitHub Desktop.
Downloader script for companion slides from http://db-book.com/
#!/usr/bin/env python
# script to download all study material slides from http://db-book.com/
# =======================================================================
# Author : Nevin Valsaraj <nevin[dot]valsaraj32[at]gmail[dot]com>
# Distributed under the MIT License.
# (See full license at http://opensource.org/licenses/MIT)
# =======================================================================
# In short, I can't be held accountable if you wreck your computer.
import urllib
import os
directory = "DB_Book_Slides"
if not os.path.exists(directory):
os.makedirs(directory)
filenames = []
for i in range(1, 27):
filenames.append('ch' + str(i))
filenames.extend(['appB', 'appC', 'appD', 'appE'])
for i in filenames:
urllib.urlretrieve(
"http://codex.cs.yale.edu/avi/db-book/db6/slide-dir/PDF-dir/" +
str(i) + ".pdf",
os.path.join(directory, "chapter_" + str(i) + ".pdf")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment