Skip to content
Advertisement

BeautifulSoup find_all limited to 50 results?

I’m trying to get the results from a page using BeautifulSoup:

req_url = 'http://www.xscores.com/soccer/livescores/25-02'
request = requests.get(req_url)
content = request.content
soup = BeautifulSoup(content, "html.parser")
scores = soup.find_all('tr', {'style': 'height:18px;'}, limit=None)
print(len(scores))
>50

I read this previous solution: Beautiful Soup findAll doesn’t find them all and I tried html.parser, lxml and html5lib, but none of them return more than 50 results. Any suggestions?

Advertisement

Answer

Try using css-selector query.

scores = soup.select('#scoretable > tr[style*="height:18px;"]')
print(len(scores))

>>>613
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement