Skip to content

Instantly share code, notes, and snippets.

@pdbartsch
Created February 7, 2019 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdbartsch/72cd4d0b55c5a40114372bdbe5049d7b to your computer and use it in GitHub Desktop.
Save pdbartsch/72cd4d0b55c5a40114372bdbe5049d7b to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
url = 'https://www.nytimes.com/'
result = requests.get(url)
c = result.content
soup = BeautifulSoup(c)
heading = soup.find_all('h2')
for story in heading:
print(story.text.strip())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment