我正在尝试使用Jsoup
从名为morningstar的网站获取股票数据。我看过其他论坛,一直没有找到问题所在。使用Jsoup获取网页元素
我试图做更先进的数据报废,但我似乎无法得到的价格。我要么返回null或根本没有。
我知道其他语言和API,但我想使用Jsoup
,因为它似乎很有能力。
这是我到目前为止有:
public class Scrape {
public static void main(String[] args){
String URL = "http://www.morningstar.com/stocks/xnas/aapl/quote.html";
Document d = new Document(URL);
try{
d = Jsoup.connect(URL).get();
}catch(IOException e){
e.printStackTrace();
}
Element stuff = d.select("#idPrice gr_text_bigprice").first();
System.out.println("Price of AAPL: " + stuff);
}
}
任何帮助,将不胜感激。
你肯定不是由JavaScript动态生成的数据? –