#Парсер новостей с Google import requests from bs4 import BeautifulSoup url = 'https://news.google.com/topics/CAAqKAgKIiJDQkFTRXdvSkwyMHZNR1ptZHpWbUVnSnlkUm9DVWxVb0FBUAE?hl=ru&gl=RU&ceid=RU%3Aru' page = requests.get(url).text soup = BeautifulSoup(page, "html.parser") h3_tags = soup.find_all('h3') for item in h3_tags: parent = item.parent news = parent.find('a', class_='DY5T1d RZIKme') print(item.text) good_link = 'https://news.google.com/' + news.get('href')[2::] print(good_link) print()
Обсуждают сегодня