Всем добрый день. Возник вопрос при парсинге новостей из Яндекса. https://yandex.ru/ Подскажите, как спарсить именно блок новостей? Вот код, но почему-то не работает.
import requests
from bs4 import BeautifulSoup
def get_html(url):
r = requests.get(url)
r.encoding = 'utf8'
return r.text
def get_link(html):
soup = BeautifulSoup(html, 'lxml')
head = soup.find('div', class_='news__header widget__content').find('span', class_="news__item-content ").get_text
print(head)
data = get_link(get_html('https://yandex.ru/'))
Заранее большое спасибо!