Skip to content

Instantly share code, notes, and snippets.

@dhensen
Created August 20, 2016 21:50
Show Gist options
  • Save dhensen/8189d401c9621bc816babcca0009bd6c to your computer and use it in GitHub Desktop.
Save dhensen/8189d401c9621bc816babcca0009bd6c to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
url = "http://www.nytimes.com"
r = requests.get(url)
r_html = r.text
soup = BeautifulSoup(r_html, "html.parser")
storyheadings = soup.select(".story-heading > a")
for heading in storyheadings:
print(heading.string.strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment