Skip to content

Instantly share code, notes, and snippets.

@pkpp1233
Created December 4, 2014 20:19
Show Gist options
  • Select an option

  • Save pkpp1233/2ff2513003bfb4866a61 to your computer and use it in GitHub Desktop.

Select an option

Save pkpp1233/2ff2513003bfb4866a61 to your computer and use it in GitHub Desktop.
Scrape Function
import urllib
from bs4 import BeautifulSoup
sport = "nhl"
html = urllib.urlopen("http://www.espn.com/" + sport).read()
headlines = [headline.get_text() for headline in BeautifulSoup(html).find(class_="headlines").find_all('li')]
print headlines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment