mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-22 21:58:42 +01:00
Add '-useBasicParsing'
This commit is contained in:
parent
a54455d581
commit
755f797bce
@ -16,7 +16,7 @@
|
||||
param([string]$location = "") # empty means determine automatically
|
||||
|
||||
try {
|
||||
$Weather = (Invoke-WebRequest http://wttr.in/${location}?format=j1 -UserAgent "curl" ).Content | ConvertFrom-Json
|
||||
$Weather = (Invoke-WebRequest http://wttr.in/${location}?format=j1 -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
||||
|
||||
$Temp = $Weather.current_condition.temp_C
|
||||
$Precip = $Weather.current_condition.precipMM
|
||||
|
@ -15,7 +15,7 @@ $Cities="Hawaii","Los Angeles","Mexico City","Miami","New York","Rio de Janeiro"
|
||||
|
||||
try {
|
||||
foreach($City in $Cities) {
|
||||
$Line = (Invoke-WebRequest http://wttr.in/${City}?format="%c %l+%t+%p+%h+%P+%w +%S →+%s" -UserAgent "curl").Content
|
||||
$Line = (Invoke-WebRequest http://wttr.in/${City}?format="%c %l+%t+%p+%h+%P+%w +%S →+%s" -UserAgent "curl" -useBasicParsing).Content
|
||||
"$Line"
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -12,7 +12,7 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
(Invoke-WebRequest http://wttr.in/Moon -UserAgent "curl" ).Content
|
||||
(Invoke-WebRequest http://wttr.in/Moon -userAgent "curl" -useBasicParsing).Content
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -16,7 +16,7 @@
|
||||
param([string]$GeoLocation = "") # empty means determine automatically
|
||||
|
||||
try {
|
||||
(invoke-webRequest http://v2d.wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
||||
(invoke-webRequest http://v2d.wttr.in/$GeoLocation -userAgent "curl" -useBasicParsing).Content
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -16,7 +16,7 @@
|
||||
param([string]$GeoLocation = "") # empty means determine automatically
|
||||
|
||||
try {
|
||||
(invoke-webRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
||||
(Invoke-WebRequest http://wttr.in/$GeoLocation -userAgent "curl" -useBasicParsing).Content
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
Loading…
Reference in New Issue
Block a user