Revision: 20000
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 4, 2009 12:41 by taec
Initial Code
import os import urllib2 import sys from BeautifulSoup import BeautifulSoup bbcurl = "http://news.bbc.co.uk/sport2/hi/football/eng_prem/fixtures/default.stm" doc = urllib2.urlopen(bbcurl).read() soup = BeautifulSoup(doc) mvbs = soup.findAll('div', { 'class' : 'mvb' }) for mvb in mvbs: if mvb.b: date = mvb.b.contents else: mvb = mvb.findNext('span') home = mvb.a.contents mvb = mvb.findNext('span') away = str(mvb.a.contents) print "DATE %s %s vs %s" % (date, home, away)
Initial URL
Initial Description
Needs the BeautifulSoup module.
Initial Title
Download premiership fixtures from BBC
Initial Tags
python
Initial Language
Python