3 ms·
For PowerShell: (Invoke-WebRequest wttr.in/Brussels).AllElements | ?{$_.tagname -eq "pre"} | Select-Object -ExpandProperty outerText
by acz 10y ago
For PowerShell:
(Invoke-WebRequest wttr.in/Brussels).AllElements | ?{$_.tagname -eq "pre"} | Select-Object -ExpandProperty outerText
- ygra 10y agoOr a bit shorter: ((iwr wttr.in/Brussels).AllElements | ? tagname -eq pre).outerText We could also wrap it into a function: function Get-Weather($Location){((iwr wttr.in/$Location).AllElements | ? tagname -eq pre).outerText}
- masklinn 10y agoOr you could just set/unset all the right headers and get the ASCII art directly (as `curl wttr.in/{location}` does) Although you'll need to interpret or strip the color codes.
- acz 10y agoThere is a hack to make PowerShell print vt100 colours http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-%28v1511%29-Console-Host-Enhancements http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-%28... Doesn’t work for me, but works for others it seems.