I'm learning Web Scraping. I would like to know how can we fetch participants count from below element?
<li class="header-hero__stat header-hero__stat--participants">
::before
"255,590 Participants"
::after
</li>
Code I've tried
soupy = bs(html,'lxml')
ul = soupy.find('li',{'class':"header-hero__stats"})
returns None
Target page
This is not content of pseudo-elements, but text content of li
node, so
li = soup.find('li',{'class':"header-hero__stat--participants"}).text
should be enough to extract '255,601 Participants'
Use .text.split()[0]
to get number only
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With