我一直试图从雅虎检索股票价格!财务,就像Apple Inc.一样.我的代码是这样的:(使用Python 2)
import requests
from bs4 import BeautifulSoup as bs
html='http://finance.yahoo.com/quote/AAPL/profile?p=AAPL'
r = requests.get(html)
soup = bs(r.text)
Run Code Online (Sandbox Code Playgroud)
问题是,当我在这个网页后面看到原始HTML时,该类是动态的,请参见下图.这使得BeautifulSoup很难获得标签.如何理解课程以及如何获取数据?
PS:1)我知道pandas_datareader.data,但那是历史数据.我想要实时库存数据;
2)我不想使用selenium打开一个新的浏览器窗口.