Shell: February 2011 Archives

Google Wether API

user-pic
Vote 0 Votes

Google Wether API 算是非官方的 API, Google 並沒有文件提到此 API 的使用
使用方式很簡單, 用城市名當變數即可, 回傳的結果是 XML, 有目前溫度及未來幾天的預報
例如: http://www.google.com.tw/ig/api?weather=Taipei
也可以用經緯度, 格式是 ,,,經度x1000000,緯度x1000000

用 wget 取得台中目前的溫濕度
# wget -qO- 'http://www.google.com.tw/ig/api?weather=Taichung' | tr '/' '\n' | awk -F'[\" ]' '/temp_c|humidity/ {print $(NF-1)}'
11
86%

Recent Entries

About this Archive

This page is an archive of entries in the Shell category from February 2011.

Shell: January 2011 is the previous archive.

Shell: August 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives