【发布时间】:2016-10-06 20:28:12
【问题描述】:
我正在尝试使用Jsoup 从名为 Morningstar 的网站获取股票数据。我查看了其他论坛,但无法找出问题所在。
我正在尝试进行更高级的数据报废,但我似乎无法获得价格。我要么返回 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 动态生成的吗?
标签: java web web-scraping jsoup