Answer the question
In order to leave comments, you need to log in
Why doesn't the parser output anything?
Good afternoon, I wrote a code for parsing the main page of Yandex. I want to parse the top 5 news items above the search bar. Here is my code:
Headers = {'тут user-agent'}
url = 'https://yandex.ru/'
response = requests.get(url, headers=Headers)
soup = BeautifulSoup(response.text, 'html.parser')
items = soup.find_all('a', class_='home-link list__item-content home-link_black_yes')
for link in items[:5]:
print(link.text)
Answer the question
In order to leave comments, you need to log in
Here is the code
soup.find_all('a', class_='home-link list__item-content home-link_black_yes')
<a class="home-link list__item-content home-link_black_yes" ...
<a class="home-link list__item-content list__item-content_with-icon home-link_black_yes"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question