Update list-weather.ps1

This commit is contained in:
Markus Fleschutz 2023-07-26 16:00:03 +02:00
parent 19a3d9ef17
commit 6ea66c2a5a

View File

@ -38,6 +38,7 @@ function GetDescription { param([string]$Text)
"Moderate or heavy snow showers"{ return "❄️ moderate or heavy snow showers ⚠️" } "Moderate or heavy snow showers"{ return "❄️ moderate or heavy snow showers ⚠️" }
"Moderate or heavy freezing rain"{ return "💧 moderate or heavy freezing rain ⚠️" } "Moderate or heavy freezing rain"{ return "💧 moderate or heavy freezing rain ⚠️" }
"Moderate rain" { return "💧 moderate rain" } "Moderate rain" { return "💧 moderate rain" }
"Moderate rain at times" { return "💧 moderate rain at times" }
"Moderate snow" { return "❄️ moderate snow" } "Moderate snow" { return "❄️ moderate snow" }
"Mist" { return "🌫 misty" } "Mist" { return "🌫 misty" }
"Overcast" { return "☁️ overcast" } "Overcast" { return "☁️ overcast" }
@ -79,7 +80,7 @@ function GetWindDir { param([string]$Text)
} }
try { try {
Write-Progress "⏳ Loading data from http://wttr.in ..." Write-Progress "⏳ Loading weather data from http://wttr.in ..."
$Weather = (Invoke-WebRequest -URI http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json $Weather = (Invoke-WebRequest -URI http://wttr.in/${Location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
Write-Progress -completed "." Write-Progress -completed "."
$Area = $Weather.nearest_area.areaName.value $Area = $Weather.nearest_area.areaName.value