Witajcie
Potrzebuję najnowszych informacji o pogodzie z danej strony
http://www.weather.com/wx/today/?lat=52.450988049&lon=20.66802978515625&locale=en_US oraz użyć JSoup
Na stronie znalazłem class
path #wx-local-wrap > div.local-wrap-inner.center-col > div.content-row-2.panel-panel.clearfix > div > div > div > div > article > div > div > article > div > section.condition > section.overview.ng-scope > div.temperature
Napisałem ten kod
String newUrl= new String("http://www.weather.com/wx/today/?lat="+lat+"&lon="+lon+"+&locale=en_US");
String tmpS=new String("http://www.weather.com/wx/today/?lat=52.450988049&lon=20.66802978515625&locale=en_US");
URL example = new URL(tmpS);
BufferedReader in = new BufferedReader(new InputStreamReader(example.openStream()));
StringBuilder websiteSource = new StringBuilder();
String tmp = null;
while ((tmp = in.readLine()) != null) {
websiteSource.append(tmp);
}
in.close();
System.out.println(websiteSource.toString());
Document doc = Jsoup.parse(websiteSource.toString());
Elements h1Elements = doc.select("#wx-local-wrap > div.local-wrap-inner.center-col > div.content-row-2.panel-panel.clearfix > div > div > div > div > article > div > div > article > div > section.condition > section.overview.ng-scope > div.temperature");
Jednak Elements jest pusty. Dlaczego?