Skip to content Skip to sidebar Skip to footer

Findall Returning Empty For Html

I'm using the BeautifulSoup module to parse an html file that I want to extract certain information from. Specifically game scores and team names. However, when I use the findAll

Solution 1:

I think the syntax your using is the old version of BeautifulSoup, try instead something like find_all snake_case (see the docs)

from bs4 import BeautifulSoup
# ...
page_html = uClient.read()
page_soup = BeautifulSoup(page_html, "html.parser")
list_of_divs = page_soup.find_all("div", class_="wisbb_name")
print(len(list_of_divs))

The older API used CamelCase, but bs4 uses snake_case

Also, notice that find_all takes can take a class_ parameter to find by class.

See this answer, https://stackoverflow.com/a/38471317/4443226, for some more info

Also, make sure you're looking for the correct classname! I don't see the class you're looking for, but rather these:

enter image description here


Post a Comment for "Findall Returning Empty For Html"