Weather from the Commandline by Igor Chubin

drmike

100% Tier-1 Gogent
I find myself looking at weather sites too often.  Part of work and need to.


Websites for weather are various states of bloat, plugins and  heavy to deal with.  I always have a slew of terminal windows open... so...


This is a good new / recent project by @igor_chubin (on Twitter) https://twitter.com/igor_chubin:


curl http://wttr.in/90210

curl http://wttr.in/seattle



For now it only outputs non US values (Celcius and km/h).   US-ificiation is coming soon.


Long live terminal friendly things like this!


PS: It works in browser also:


http://wttr.in/manisa


Code for the project: https://github.com/chubin/wttr.in
 

drmike

100% Tier-1 Gogent
@MannDude It will help you for now to become a good world citizen and adapt to Celcius :)
 
Last edited by a moderator:

GM2015

New Member
It needs curl user-agent to work though.


My curlrc file is set to  Windows firefox to avoid website 403s most of the time. If you curl it with non-curl useragent, you get html source.


[email protected]:/dev/null$ pc curl -L -A "curl 666 satanic edition" wttr.in/washington
ProxyChains-3.1 (http://proxychains.sf.net)
|DNS-request| wttr.in
|R-chain|-<>--<><>-OK
|DNS-response| wttr.in is ..
|R-chain|-<>--<--timeout
|R-chain|-<>--<><>-OK
Weather for City: Washington, United States of America

    \  /       Partly Cloudy
  _ /"".-.     17 °C         
    \_(   ).   ↑ 24 km/h     
    /(___(__)  16 km         
               0.0 mm        
                                                       long result

Follow @igor_chubin for wttr.in updates


Well done to the man, programmers always amaze with their achievements.
 
Last edited by a moderator:

drmike

100% Tier-1 Gogent
Pretty nifty.... of you to have curl setting browser.. Indeed common problem getting blocked due to such for me on downloads.


@igor_chubin is active with this project, so I am expecting more goodies :)
 

Lewis-H

Member
wttr.in currently supports five output formats:

ANSI for the terminal;
Plain-text for the terminal and scripts;
HTML for the browser;
PNG for the graphical viewers;
JSON for scripts and APIs;
Prometheus metrics for scripts and APIs.
The ANSI and HTML formats are selected basing on the User-Agent string. The PNG format can be forced by adding .png to the end of the query:

$ wget wttr.in/Paris.png
You can use all of the options with the PNG-format like in an URL, but you have to separate them with _ instead of ? and &:

$ wget wttr.in/Paris_0tqp_lang=fr.png
Useful options for the PNG format:

t for transparency (transparency=150);
transparency=0..255 for a custom transparency level.
Transparency is a useful feature when weather PNGs are used to add weather data to pictures:

$ convert source.jpg <( curl wttr.in/Oymyakon_tqp0.png ) -geometry +50+50 -composite target.jpg
In this example:

source.jpg - source file;
target.jpg - target file;
Oymyakon - name of the location;
tqp0 - options (recommended).
 
Top