Created
July 19, 2013 22:00
-
-
Save tcash21/6042650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import re | |
import urllib2 | |
from bs4 import BeautifulSoup | |
page = urllib2.urlopen("http://fantasyfootballcalculator.com/completed_drafts.php?format=standard").read() | |
soup = BeautifulSoup(page) | |
#print soup.prettify() | |
li = [] | |
for link in soup.find_all("a"): | |
li.append(link.get("href")) | |
def filtah(x): | |
return x.startswith("draft") | |
newlist = filter(filtah, li) | |
for draft in newlist: | |
page = urllib2.urlopen("http://fantasyfootballcalculator.com/" + draft) | |
soup = BeautifulSoup(page) | |
table = soup.find('tbody', attrs={"id": "draftboardBody"}) | |
rows = table.findChildren(['tr']) | |
for row in rows: | |
rounds = row.find('td', {"class": "rowLabel"}) | |
for round in rounds: | |
value = round.string | |
print "value is %s" % value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment