#!/usr/bin/python import BeautifulSoup import newurllib2 import datetime Soup = BeautifulSoup.BeautifulSoup response = newurllib2.urlopen('http://www.nfl.com/teams/pittsburghsteelers/schedule?team=PIT').read() soup = Soup(response) ranking = str(soup.find("p", attrs={"class": "team-overall-ranking"}).contents) foo, rank, record = ranking.split("'") rank = rank.strip() foo, rec, bar = record.split("<") foo, newrec = rec.split(">") foo, newrec = newrec.split("(") newrec, bar = newrec.split(")") response = newurllib2.urlopen('http://www.sbnation.com/nfl/teams/pittsburgh-steelers').read() soup = Soup(response) soup = Soup(str(soup.find("div", attrs={"class": "sbn-pte-head-team-next-game"}).contents)) next = str(soup.find("p").contents) foo, date, bar = next.split(" ") date = date.strip() date, bar = date.split("EST") day, date, year, time = date.split(",") day = day.strip() date = date.strip() m, d = date.split(" ") d = int(d)
#!/usr/bin/python import BeautifulSoup import newurllib2 import re import datetime Soup = BeautifulSoup.BeautifulSoup response = newurllib2.urlopen('http://www.cbssports.com/nhl/teams/page/PIT/pittsburgh-penguins').read() soup = Soup(response) rec = str(soup.find("div", attrs={"class": "record"}).contents) url, rec, other = rec.split(">") rec, other = rec.split("|") rec = rec.strip() rec, bar = rec.split(" ") foo, rank = other.split("Metropolitan") rank, bar = rank.split("<") rank = rank.strip() foo, rank = rank.split("(") rank, bar = rank.split(")") soup = Soup(str(soup.find("div", attrs={"class": "matchUpTeams"}).contents)) dt = str(soup.find("div").contents) foo, date, other = dt.split("'")
#!/usr/bin/python import BeautifulSoup import newurllib2 import datetime Soup = BeautifulSoup.BeautifulSoup response = newurllib2.urlopen('http://www.dcunited.com/standings').read() soup = Soup(response) classes = Soup(str(soup.findAll('tr'))) for c in classes: c = Soup(str(c)) #print c.prettify() data = c.find("td", attrs={"data-title": "Club"}) if data: data = data.contents foo, data, bar = str(data).split("'") if data=="D.C. United": break else: continue rank = str(c.find("td", attrs={"data-title": "Rank"}).contents) foo, rank, bar = rank.split("'") record = str(c.find("td", attrs={"data-title": "W-L-T"}).contents) foo, record, bar = record.split("'") """ month = ["blah", "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"] response = newurllib2.urlopen('http://www.dcunited.com/schedule').read() soup = Soup(response)