Beautifulsoup iterating through scraped data
I have this html code that is repeating multiple times:
div class=Company_line-logo image-loader-target data-image-loader-height=47 data-image-loader-height-mobile=47 data-image-loader-src=/var/fiftyPartners/storage/images/startups/woleet/3261-1-fre-FR/Woleet_company_line_logo.png data-image-loader-src-mobile=/var/fiftyPartners/storage/images/startups/woleet/3261-1-fre-FR/Woleet_company_line_logo_mobile.png data-image-loader-width=189 data-image-loader-width-mobile=189 style='background-image:url(http://en.50partners.fr/var/fiftyPartners/storage/images/startups/woleet/3261-1-fre-FR/Woleet_company_line_logo.png);'/div
h5 class=Company_line-titleWoleet/h5
div class=Company_line-description
By using:
for blocks in soup:
block = soup.find('a', class_='Company_line logo-contains-name').find('h5').get_text()
I can get what I want that is Woleet in between the h5 tags.
I tried to iterate this to get all of them:
block = soup.find('a', class_='Company_line logo-contains-name')
for name in block:
names = block.find_all('h5')
it returns only 1 h5 class=Company_line-titleWoleet/h5 whereas I should get 50 names like Woleet.
How can I iterate this and get the text from all h5 tags?
Thanks!
Topic web-scraping python
Category Data Science