Beginning Python and BeautifulSoup user here.
I'm trying to scrape some sports score from ESPN website but the returns are empty.
Sample Target: ESPN Website > NBA > Scores
I want to get some info such as Team Name, Score, Record, and Quarter/Final but since I'm having trouble I'll just start with Score. I would like to get the total score of the teams.
from bs4 import BeautifulSoup as bs
from urllib.request import urlopen as uReq
html_url = 'http://www.espn.co.uk/nba/scoreboard'
uClient = uReq(html_url)
page_html = uClient.read()
uClient.close()
page_soup = bs(page_html, 'html.parser')
containers = page_soup.findAll('td',{"class":"total"})
print (len(containers))
print (type(containers))
Output
0
<class 'bs4.element.ResultSet'>
I spent the whole day trying to figure out why all my results keep coming back NoneType and empty I can't seem to figure it out.
I tried just looking for 'td' and this is the result
containers = page_soup.findAll('td')
print (len(containers))
print (type(containers))
Output
0
<class 'bs4.element.ResultSet'>
Not sure why I'm unable to pull the data. Is there something going on behind the scenes that ESPN is purposely not allowing us to scrape or something? I have tried looking through different tags, attributes, etc but can't figure it out. Thank you