【发布时间】:2016-12-20 18:08:16
【问题描述】:
我想从这个 URL 上的隐藏日历中解析 9 月的日期+价格:http://www.lufthansa.com/vol/vol-paris-berlin。这里的问题是,当您按 9 月时,页面将生成日历,但 url 没有变化。我使用了这段代码,但没有结果。
public static void main(String[] args)
throws FailingHttpStatusCodeException, MalformedURLException, IOException {
WebClient webClient = new WebClient();
HtmlPage myPage = webClient.getPage("http://www.lufthansa.com/vol/vol-paris-berlin");
Document doc = Jsoup.parse(myPage.asXml());
for(Element s : doc.select("button.daygrid_cell.hasprice")) {
String weekday_text = s.select(".weekday_text").text();
String pricebox = s.select(".pricebox > .br").text();
System.out.println(
String.format(
"weekday_text=%s pricebox=%s",
weekday_text,
pricebox));
}
webClient.close();}
【问题讨论】:
标签: javascript java jsoup htmlunit