Created
August 20, 2016 21:50
-
-
Save dhensen/8189d401c9621bc816babcca0009bd6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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