mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-07 17:14:39 +02:00
Add '-useBasicParsing'
This commit is contained in:
parent
a54455d581
commit
755f797bce
@ -16,7 +16,7 @@
|
|||||||
param([string]$location = "") # empty means determine automatically
|
param([string]$location = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
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
|
$Temp = $Weather.current_condition.temp_C
|
||||||
$Precip = $Weather.current_condition.precipMM
|
$Precip = $Weather.current_condition.precipMM
|
||||||
|
@ -15,7 +15,7 @@ $Cities="Hawaii","Los Angeles","Mexico City","Miami","New York","Rio de Janeiro"
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
foreach($City in $Cities) {
|
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"
|
"$Line"
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(Invoke-WebRequest http://wttr.in/Moon -UserAgent "curl" ).Content
|
(Invoke-WebRequest http://wttr.in/Moon -userAgent "curl" -useBasicParsing).Content
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
param([string]$GeoLocation = "") # empty means determine automatically
|
param([string]$GeoLocation = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
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
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
param([string]$GeoLocation = "") # empty means determine automatically
|
param([string]$GeoLocation = "") # empty means determine automatically
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(invoke-webRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
|
(Invoke-WebRequest http://wttr.in/$GeoLocation -userAgent "curl" -useBasicParsing).Content
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
Loading…
Reference in New Issue
Block a user