我试图抓住本页右侧嵌入的图表的股票行情。 http://investsnips.com/list-of-publicly-traded-micro-cap-diversified-biotechnology-and-pharmaceutical-companies/
在检查html时,股票符号似乎嵌入在标题下("纳斯达克代码:ADMA"),下面代表一个符号的代码:
<td class="symbol-short-name-container" title="NASDAQ:ADMA" style="cursor:
pointer;"><a href="https://www.tradingview.com/chart/?symbol=NASDAQ%3AADMA"
target="_blank">ADMA Biologics</a></td>
但是,我未能通过find_all捕获此代码。
import bs4 as bs
import urllib.request
import re
source = urllib.request.urlopen('http://investsnips.com/list-of-publicly-traded-micro-cap-diversified-biotechnology-and-pharmaceutical-companies/').read()
soup = bs.BeautifulSoup(source,'lxml')
body = soup.body (#It seems to be under body)
之后
body.find_all('tr', class_="ticker quote-ticker-inited")
[] # empty list
body.find_all('td', class_="symbol-short-name-container")
[] #empty list