Hacker News Re-Imagined

`curl wttr.in`: Weather in your terminal

  • 368 points
  • 9 days ago

  • @cercatrova
  • Created a post

`curl wttr.in`: Weather in your terminal


@nooyurrsdey 9 days

Replying to @cercatrova 🎙

Only HN can be so critical of what is a really cool project.

Honestly this is a great _simple_ way to access weather without leaving my terminal. Love the basic ASCII graphics.

I noticed it's a LOT faster when I provide the city, probably because it doesn't have to look it up from IP:

``` curl wttr.in/atlanta ```

Nice work.

Reply


@nickstinemates 9 days

Replying to @cercatrova 🎙

this is really nice, i like the rendering and simplicity. it's aesthetically pleasing. overall 10/10 experience.

Reply


@trinovantes 9 days

Replying to @cercatrova 🎙

If only there's a $PS1 version

Reply


@anovikov 8 days

Replying to @cercatrova 🎙

cool widget but sucks on a mac where default background is white. yellow stuff is almost invisible.

Reply


@prezjordan 9 days

Replying to @cercatrova 🎙

Cute idea!

Reply


@granddave 9 days

Replying to @cercatrova 🎙

This is a really nice service and I have used it for quite some time. Just a small reminder; to relieve the wttr servers, please cache the results on disk if you for example want to have a higher refresh rate on your tmux status bar.

See my dotfiles repo [1] if you're interested in such implementation

[1] https://github.com/Granddave/dotfiles/tree/master/tmux

Reply


@sylware 8 days

Replying to @cercatrova 🎙

interop done the right way: this guy is going to be in trouble with the web javascript kiddies.

Yes, if this guy is a state-sponsored computer security hacker, he could pown the 3, maybe 4, ppl (and I am one of them) using its http services via curl and our terminals or image format parsers or etc. Is this worth for that many ppl?

Anyways, that's too sexy, I am willing to take the bait.

That said, I could use an official/trusted online source for the weather information and format it myself (I guess I would get a CSV or json or xml file).

Reply


@nixpulvis 8 days

Replying to @cercatrova 🎙

So I do a basic `curl wttr.in` and I get back a line "Weather report: not found" followed however, by what appears to be a full weather report. Two things:

1. Either give me an error and exit, or warn me about something meaningful 2. Show me the location of the weather report, as it stands I'm left guessing

Otherwise, it's nice to see people making simple text interfaces for important data like this.

Reply


@agumonkey 9 days

Replying to @cercatrova 🎙

I wonder how far you could push the web into this mode.

Everything in tiny ascii strips. Even shopping, or other needs. A challenge in cute minimalism (not crippled).

Reply


@innocenat 9 days

Replying to @cercatrova 🎙

I have to scroll all they way down to the buttom to find the information source -- WorldWeatherOnline. Does people not care about where their whether data is sourced from?

Living in Japan, I have always been wary of these type of service, since I find a lot of them really inaccurate. And I just checked, Tokyo show 15C on that website, while high resolution current weather information from Japan Metrological Agency show 18C.

Reply


@yasenn 8 days

Replying to @cercatrova 🎙

Igor created several great cli projects like cheat.sh[1], late.nz[2], QRenco.de[3],rate.sx[4]

Also, he maintains the awesome-console-services[5] list

[1] https://github.com/chubin/cheat.sh

[2] https://github.com/chubin/late.nz

[3] https://github.com/chubin/qrenco.de

[4] https://github.com/chubin/rate.sx

[5] https://github.com/chubin/awesome-console-services

Reply


@tonto 9 days

Replying to @cercatrova 🎙

A very fun way to have this, tmux status bar weather! `set -g status-left '#(curl "wttr.in/YourTown?u&format=3")'`. This way you can always see the latest :)

Reply


@pschastain 8 days

Replying to @cercatrova 🎙

A nice idea but it gives the wrong info for Spokane, WA, USA

Reply


@taf2 9 days

Replying to @cercatrova 🎙

This is really neat...

vim ~/.bashrc

``` alias weather='/usr/bin/curl wttr.in' ``` :wq

and now:

weather

Reply


@every 9 days

Replying to @cercatrova 🎙

I simply use the ansiweather app [0] through an alias in the terminal...

[0]: https://github.com/fcambus/ansiweather

Reply


@shdon 8 days

Replying to @cercatrova 🎙

I'm a little amused by its weather report classifying the night as "Sunny", when it probably just means the sky will be clear.

Reply


@dgl 9 days

Replying to @cercatrova 🎙

Remember with this kind of thing you're trusting the remote site with access to your terminal emulator. There have been various security problems with some more advanced terminals and escape sequences in the past[1][2].

Personally I think it's a cute thing and have implemented some similar little easter eggs to this via: curl ip.wtf/moo

[1]: https://blog.mozilla.org/security/2019/10/09/iterm2-critical... [2]: https://packetstormsecurity.com/files/162621/rxvt-2.7.0-rxvt...

Reply


@Kim_Bruning 9 days

Replying to @cercatrova 🎙

so the obvious (for me) thing to try was:

watch -n 600 -c 'curl -s v2.wttr.in/'

This ALMOST works, but somehow it messes up the formatting for me. For some reason watch doesn't pass through formatting cleanly or so?

Reply


@netsharc 8 days

Replying to @cercatrova 🎙

Seems like it breaks when it can't find the geo-location, it says "Weather report: not found" but still shows the weather forecast from... somewhere?

Reply


@pesnk 3 days

Replying to @cercatrova 🎙

in ~ 2016 I built a plugin for on-my-fish to simplify the process of curling wttr.in https://github.com/oh-my-fish/plugin-wttr. From today I'm still using this plugin a lot. Checking out the weather on your terminal turns out to be faster than open a weather website or unlock my phone and check in out a weather app.

Reply


@nazka 8 days

Replying to @cercatrova 🎙

My little custom command (HN formatting break it all so need to be nicely formatted again).

alias weather=weather function weather() { if [ $# -le 2 ]; then Command="wttr.in/$1" if [ $# -eq 2 ]; then Command="$Command,$2" fi fi Command="curl ${Command// /%20}" eval $Command }

Reply


@aftbit 9 days

Replying to @cercatrova 🎙

In the USA, I like the National Weather Service direct APIs. I wish I could get more granular forecast data, both in time and space, but they forecast dewpoint/humidity, which is really nice.

Reply


@buzzdenver 9 days

Replying to @cercatrova 🎙

I get "Weather report: not found" on the first line and then a 3 day forecast for idk what location.

Reply


@simlan 9 days

Replying to @cercatrova 🎙

Love it. Was expecting maybe one limited end-point and was scrolling 5mins through all the features. Very cool

Reply


@secondcoming 8 days

Replying to @cercatrova 🎙

That is very lovely. Well done!

Reply


@nickjj 9 days

Replying to @cercatrova 🎙

I've had this shell function / alias set up for years:

    weather () {
        curl "https://wttr.in/${1}"
    }

This lets you run: weather nyc, a zip code and everything else wttr.in supports.

Reply


@cercatrova 9 days

Replying to @cercatrova 🎙

More cool console services like this one: https://github.com/chubin/awesome-console-services

  curl wttr.in/Moon
Shows moon phases

  curl rate.sx
Shows cryptocurrency exchange rates, from the same author as wttr.in

I sourced the above commands from a previous HN post: https://news.ycombinator.com/item?id=23646953

Reply


@sigg3 9 days

Replying to @cercatrova 🎙

I'm going to add that if you live in Norway, YR has nice weather data available for free (required by law). Shameless plug for my little CLI tool when I was beginning to learn go:

https://github.com/sigg3/weather_query/

Reply


@cmeacham98 9 days

Replying to @cercatrova 🎙

There's also `curl v2.wttr.in`, but imho I like the original better.

Reply


About Us

site design / logo © 2022 Box Piper