wttr.in icon indicating copy to clipboard operation
wttr.in copied to clipboard

Improve IP-based geolocation

Open tr1xem opened this issue 8 months ago • 6 comments

I guess it should return weather data according to the location it got from ip??

Its returing

Weather report: not found

But While passed with location (that too fetched from ip) it returns correct weather

tr1xem avatar Mar 23 '25 04:03 tr1xem

It is possible that it works when you specify your location manually. It just means that the service can't detect your location based on your IP address.

Can you please verify that it is exactly this problem?

$ curl ifcfg.me
# to get your IP as it is visible from outside

$ curl wttr.in/@<YOUR_IP>

If it returns not-found again, the problem is exactly what I meant. If it resolves your location, though, it means there should be a bug.

Please check.

chubin avatar Mar 23 '25 12:03 chubin

🞈 curl wttr.in/@{myip} Weather report: not found

This is the output

tr1xem avatar Mar 23 '25 14:03 tr1xem

Okay, then everything is as expected. Anyway, thank you for reporting, and I hope that we will increase the quality of our IP-based geolocation in the future. Stay tuned.

chubin avatar Mar 23 '25 14:03 chubin

Tuned as ever

tr1xem avatar Mar 24 '25 03:03 tr1xem

Yeah, I've been getting "not found" location as well, and it's the same thing (if I call it with my IP specifically, it still returns not found).

IpInfo's location service seems to work (thanks @nariox). In PowerShell, this will work (except that it produces text talking about a specific address in the center of my local city):

irm "wttr.in/$((irm ipinfo.io/json).loc)"

To make it generic, you can use the city/region/country properties from ipinfo, like:

irm "wttr.in/$(irm ipinfo.io/json|%{$_.city,$_.region,$_.country})"

Jaykul avatar Apr 26 '25 19:04 Jaykul

I was also having the same situation while on a college campus. My ugly hack is to use this command instead: curl -sS wttr.in/$(curl -sS ipinfo.io/json | jq -r '.loc')

nariox avatar May 28 '25 15:05 nariox