2011/11/13

gaucheでgoogleの非公開apiを使って天気を取得するコマンド

某所で掲題のようなgaucheのコードを見かけたのでコマンドにしてみた。
$ ./weather kumamoto
kumamoto:2011-11-12
condition:Cloudy
temp_f:60
temp_c:15
humidity:Humidity: 77%
icon:/ig/images/weather/cloudy.gif
wind_condition:Wind: E at 0 mph

day_of_week:Sat
low:52
high:73
icon:/ig/images/weather/mostly_sunny.gif
condition:Partly Sunny

day_of_week:Sun
low:46
high:70
icon:/ig/images/weather/mostly_sunny.gif
condition:Mostly Sunny

day_of_week:Mon
low:37
high:63
icon:/ig/images/weather/sunny.gif
condition:Clear

day_of_week:Tue
low:41
high:64
icon:/ig/images/weather/sunny.gif
condition:Clear
$ ./weather -j kumamoto
{"date":"2011-11-12","current":{"condition":"Cloudy","temp_f":"60","temp_c":"15","humidity":"Humidity: 77%","icon":"/ig/images/weather/cloudy.gif","wind_condition":"Wind: E at 0 mph"},"in_the_future":[{"day_of_week":"Sat","low":"52","high":"73","icon":"/ig/images/weather/mostly_sunny.gif","condition":"Partly Sunny"},{"day_of_week":"Sun","low":"46","high":"70","icon":"/ig/images/weather/mostly_sunny.gif","condition":"Mostly Sunny"},{"day_of_week":"Mon","low":"37","high":"63","icon":"/ig/images/weather/sunny.gif","condition":"Clear"},{"day_of_week":"Tue","low":"41","high":"64","icon":"/ig/images/weather/sunny.gif","condition":"Clear"}]}#% 
ソースはこちら

関連

プログラミングGauche

0 件のコメント:

コメントを投稿