static L<Double> openWeatherMap_simpleCelsiusForecast(S cityName) {
S url = "http://api.openweathermap.org/data/2.5/forecast";
S xml = loadPageWithParams(url, APPID := openWeatherMapAPIKey(), q := cityName, mode := "xml");
new TreeMap<S, Double> maxPerDay;
for (L<S> tTime : findContainerOrEmptyTag(xml, "time")) {
S from = tagParam(tTime, "from");
S day = takeFirst(from, lastIndexOf(from, "T"));
L<S> tTemperature = first(findContainerOrEmptyTag(tTime, "temperature"));
double maxTemp = kelvinToCelsius(parseDouble(tagParam(tTemperature, "max")));
maxPerDay.put(day, max(maxTemp, toDouble(maxPerDay.get(day))));
}
ret valuesAsList(maxPerDay);
}Began life as a copy of #1013965
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1013973 |
| Snippet name: | openWeatherMap_simpleCelsiusForecast |
| Eternal ID of this version: | #1013973/2 |
| Text MD5: | fe6f9094f42019b01e7cdc1abb4b3449 |
| Author: | stefan |
| Category: | javax / networking |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-03-18 19:25:35 |
| Source code size: | 690 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 905 / 872 |
| Version history: | 1 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1018188 - openWeatherMap_maxTempForecast (Celsius) |