1 | static L<Double> openWeatherMap_simpleCelsiusForecast(S cityName) {
|
2 | S url = "http://api.openweathermap.org/data/2.5/forecast"; |
3 | S xml = loadPageWithParams(url, APPID := openWeatherMapAPIKey(), q := cityName, mode := "xml"); |
4 | new TreeMap<S, Double> maxPerDay; |
5 | for (L<S> tTime : findContainerOrEmptyTag(xml, "time")) {
|
6 | S from = tagParam(tTime, "from"); |
7 | S day = takeFirst(from, lastIndexOf(from, "T")); |
8 | L<S> tTemperature = first(findContainerOrEmptyTag(tTime, "temperature")); |
9 | double maxTemp = kelvinToCelsius(parseDouble(tagParam(tTemperature, "max"))); |
10 | maxPerDay.put(day, max(maxTemp, toDouble(maxPerDay.get(day)))); |
11 | } |
12 | ret valuesAsList(maxPerDay); |
13 | } |
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: | 762 / 736 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |