Skip to content

Instantly share code, notes, and snippets.

@csessig86
Created February 20, 2012 20:19
Show Gist options
  • Save csessig86/1871166 to your computer and use it in GitHub Desktop.
Save csessig86/1871166 to your computer and use it in GitHub Desktop.
Timeline.py part 1
import urllib2
from BeautifulSoup import BeautifulSoup
import datetime
import re
now = datetime.datetime.now()
# Create a CSV where we'll save our data. See further docs:
# http://propublica.github.com/timeline-setter/#csv
f = open('timeline.csv', 'w')
# Make the header rows. These are based on headers recognized by TimelineSetter.
f.write("date" + "," + "description" + "," + "link" + "," + "html" + "\n")
# URL we will scrape
url = 'http://wcfcourier.com/test/scrape/dunkerton/'
page = urllib2.urlopen(url)
soup = BeautifulSoup(page)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment