T
T
tofel2019-11-12 16:55:13
Python
tofel, 2019-11-12 16:55:13

How to use BeautifulSoup to extract href= links?

Began to study BeautifulSoup strongly do not kick for a stupid question, how to parse all href =

[<a class="game-information__link" href="/sport/stavki/prematch/futbol--1/evropa--3/liga-chempionov-uefa--567/liverpul-napoli--27-11-2019--4491172"><div class="game-information__top"><div class="game-information__name"><span class="game-information__team"><span class="search__highlight">Ливерпуль</span></span> – <span class="game-information__team">Наполи</span></div></div><div class="game-information__live"><span class="game-information__live-info"><span class="game-information__date-part">23:00</span><span class="game-information__live-period"></span></span><span class="game-information__live-icons-list"></span></div></a>, <a class="game-information__link" href="/sport/stavki/prematch/futbol--1/angliya--258/premer-liga--539/kristal-pelas-liverpul--23-11-2019--4474186"><div class="game-information__top"><div class="game-information__name"><span class="game-information__team">Кристал Пэлас</span> – <span class="game-information__team"><span class="search__highlight">Ливерпуль</span></span></div></div><div class="game-information__live"><span class="game-information__live-info"><span class="game-information__date-part">18:00</span><span class="game-information__live-period"></span></span><span class="game-information__live-icons-list"></span></div></a>, <a class="game-information__link" href="/sport/stavki/prematch/futbol--1/angliya--258/premer-liga--539/liverpul-brajton--30-11-2019--4491471"><div class="game-information__top"><div class="game-information__name"><span class="game-information__team"><span class="search__highlight">Ливерпуль</span></span> – <span class="game-information__team">Брайтон</span></div></div><div class="game-information__live"><span class="game-information__live-info"><span class="game-information__date-part">18:00</span><span class="game-information__live-period"></span></span><span class="game-information__live-icons-list"></span></div></a>]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
r4khic, 2019-11-13
@r4khic

What is the actual problem?

soup = BeautifulSoup("тут должен быть html код страницы", 'lxml')
resource_links_blocks = soup.findAll('a', {'class': 'game-information__link'})   # Массив относительных ссылок

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question