I'm trying to scrape some numbers from the Risk Statistics table on a yahoo finance webpage using BeautifulSoup and Python 2.7: https://finance.yahoo.com/quote/SHSAX/risk
So far, I've looked at the html using https://codebeautify.org:
#!/usr/bin/python
from bs4 import BeautifulSoup, Comment
import urllib
riskURL = "https://finance.yahoo.com/quote/SHSAX/risk"
page = urllib.urlopen(riskURL)
content = page.read().decode('utf-8')
soup = BeautifulSoup(content, 'html.parser')
My trouble is actually getting the numbers using soup.find. For example, standard deviation:
# std should be 13.44
stdevValue = float(soup.find("span",{"data-reactid":"124","class":"W(39%) Fl(start)"}).text)
# std of category should be 0.18
stdevCat = float(soup.find("span",{"data-reactid":"125","class":"W(57%) Mend(5px) Fl(end)"}).text)
Both of these calls to soup.find return none. What am I missing?