I’m trying to get the prices from this URL. Can someone tell me what I’m doing wrong?
https://stockcharts.com/h-hd/?%24GSPCE
JavaScript
x
7
1
resp = requests.get(BASE_URL).content
2
soup = BeautifulSoup(resp, 'html.parser')
3
prices = soup.find('div', {'class': 'historical-data-descrip'})
4
5
content = str(prices)
6
print(content)
7
Advertisement
Answer
Stockcharts only provides historical data to StockChart members, so you probably need to pass some kind of authentication.
Or use an api like this one