Skip to content

Scraping for Hinman Box Numbers

January 17, 2013

Dartmouth’s CS50 “Software Design and Implementation” class is a gift that keeps on giving. Yes, it was basically a full-time job on top of my other coursework, and yes, it kept me from attending as many frat parties as I wanted to last spring. But it also taught me shell scripting, which has proven incredibly useful on numerous occasions.

The latest example: my fraternity recently had a party where we wanted everyone we invited to get physical invitations in their mailboxes. Here’s the shell script that made that possible:

while read p; do
  NAME=`echo $p | sed 's/ /%20/g'`
  curl -silent "http://dndlookup.dartmouth.edu/datapage_dartmouth.php?name=${NAME}&fmat=1" | grep -o "HB [0-9]*"
done < $1

The script takes an input text file with one name per line and then scrapes the Dartmouth Name Directory for each person’s Hinman box using curl. I kind of feel like Mark Zuckerburg downloading Harvard’s facebook data every time I run it.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: