Skip to content

Instantly share code, notes, and snippets.

@flyte
Created December 17, 2013 10:40
Show Gist options
  • Save flyte/8003007 to your computer and use it in GitHub Desktop.
Save flyte/8003007 to your computer and use it in GitHub Desktop.
Get text from First Capital Connect major disruption website
from mechanize import Browser
from BeautifulSoup import BeautifulSoup
if __name__ == "__main__":
br = Browser()
page = br.open("http://www.firstcapitalconnect.co.uk/plan-your-journey/major-disruption/")
soup = BeautifulSoup(page.get_data())
s = soup.find("div", {"class": "single-container"})
lines = s.findAll("span")
text = ""
for l in lines:
text += "%s\n" % l.text
print text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment