Re:ASCII Art Weather
by acz on Thursday April 14, 2016 @06:57AM
(#11495580)
For PowerShell:
(Invoke-WebRequest wttr.in/Brussels).AllElements | ?{$_.tagname -eq "pre"} | Select-Object -ExpandProperty outerText
[ Parent
| on HN ]
Or 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}Or 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.
There is a hack to make PowerShell print vt100 colours http://www.nivot.org/blog/post/2016/02/04/Windows-10-TH2-%28...
Doesn’t work for me, but works for others it seems.