1 | static Map<S, Int> openWeatherMap_maxTempForecast(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, Int> 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 | int maxTemp = iround(kelvinToCelsius(parseDouble(tagParam(tTemperature, "max")))); |
10 | maxPerDay.put(day, max(maxTemp, toInt(maxPerDay.get(day)))); |
11 | } |
12 | ret maxPerDay; |
13 | } |
Began life as a copy of #1013973
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018188 |
Snippet name: | openWeatherMap_maxTempForecast (Celsius) |
Eternal ID of this version: | #1018188/1 |
Text MD5: | 06177d5cc12f06cacf5da408acc9c045 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-08 11:19:28 |
Source code size: | 671 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 345 / 376 |
Referenced in: | [show references] |