【发布时间】:2016-05-28 23:08:54
【问题描述】:
如何使用 JSOUP 解析 request 的响应,我需要从表中获取数据,当我查看源代码时,我发现只是一个静态 html,但我怎么能获取数据?
编辑:
ArrayList<String> downServers = new ArrayList<>();
Date date = new Date();
url = "http://billetterie.ctm.ma/site/get_voyages?nat=1&tov1=nat&aller=AS&ag_dep=001&ag_arr=002&datev=29-05-2016&dater=29-05-2016&nbp=1&tpay=MA&horr=non";
String URL1 = "http://billetterie.ctm.ma/site/select_voyages_aller?datev=29-05-2016&agen_dep=001&agen_dest=002&nbp=1&dater=29-05-2016&aller=AS&tpay=MA&q=1&_search=false&nd="+date.getTime()+"&rows=30&page=1&sidx=&sord=";
Document doc = null;
try {
response = Jsoup.connect(url).timeout(10000).method(Connection.Method.GET).execute();
Map<String, String> cookies = response.cookies();
doc = Jsoup.connect(URL1).timeout(10000).cookies(cookies).get();
;
} catch (IOException e) {
e.printStackTrace();
}
【问题讨论】:
-
使用 AJAX 调用请求数据。
-
那么,我怎样才能得到这些数据,你知道吗??