I'm trying to grab the headlines from the NY Times front page (www.nytimes.com).
Process finishes without printing text (or anything) from the soup.find_all function.
I've played around with the syntax, changing it from soup.find_all(class_="blancedHeadline") to soup.find_all("span", {"class" : "blancedHeadline") even adding attrs= right before the class distinction.
Here's the code I have and after trying to figure out what I'm doing wrong for a while, I don't know what's causing the issue:
import requests
from bs4 import BeautifulSoup
base_url = 'https://www.nytimes.com/'
r = requests.get(base_url)
soup = BeautifulSoup(r.text, 'lxml')
headline_text = soup.find_all('span', {'class':'balancedHeadline'})
for headline in headline_text:
print(headline)