我试了下,可以直接在网址后加上地址名称或是指定一个ip地址给它判断位置,比如:
curl -s -4 zh.wttr.in/shenzhen
天氣預報: Shenzhen, China
\ / 局部多云
_ /"".-. 29..37 °C
\_( ). ↖ 22 km/h
/(___(__) 10 km
0.0 mm
使用命令curl wttr.in/:help可以得到很多参数,可以用多种方式定位,可以加参数来显示哪个语言版本,显示近几天的天气预报,还是很方便的
Usage: $ curl wttr.in # current location $ curl wttr.in/muc # weather in the Munich airportSupported location types: /paris # city name /~Eiffel+tower # any location /Москва # Unicode name of any location in any language /muc # airport code (3 letters) /@stackoverflow.com # domain name /94107 # area codes /-78.46,106.79 # GPS coordinatesSpecial locations: /moon # Moon phase (add ,+US or ,+France for these cities) /moon@2016-10-25 # Moon phase for the date (@2016-10-25)Units: m # metric (SI) (used by default everywhere except US) u # USCS (used by default in US) M # show wind speed in m/sView options: 0 # only current weather 1 # current weather + 1 day 2 # current weather + 2 days A # ignore User-Agent and force ANSI output format (terminal) F # do not show the "Follow" line n # narrow version (only day and night) q # quiet version (no "Weather report" text) Q # superquiet version (no "Weather report", no city name) T # switch terminal sequences off (no colors)PNG options: /paris.png # generate a PNG file p # add frame around the output t # transparency 150 transparency=... # transparency from 0 to 255 (255 = not transparent)Options can be combined: /Paris?0pq /Paris?0pq&lang=fr /Paris_0pq.png # in PNG the file mode are specified after _ /Rome_0pq_lang=it.png # long options are separated with underscoreLocalization: $ curl fr.wttr.in/Paris $ curl wttr.in/paris?lang=fr $ curl -H "Accept-Language: fr" wttr.in/parisSupported languages: af da de fr fa et id it nb nl pl pt-br ro ru uk (supported) az be bg bs ca cy cs el eo es fi hi hr hu hy is ja jv ka kk ko ky lt lv mk ml nl nn pt pt-br sk sl sr sr-lat sv sw th tr te uz vi zh zu he (in progress)Special URLs: /:help # show this page /:bash.function # show recommended bash function wttr() /:translation # show the information about the translators