Help us understand the problem. What is going on with this article?

シェルで今日の天気予報表示

More than 5 years have passed since last update.
  • livedoor天気予報が提供するWeather HacksのAPIを利用する。
  • 結果はJSONで返ってくるのでjqコマンドに渡す。jqbrew intall jqなどしてインストール
$ curl -s http://weather.livedoor.com/forecast/webservice/json/v1\?city\=XXXXXX | jq -r '.forecasts[] | select(.dateLabel == "今日").telop'

XXXXXXに地域IDを入力。地域IDはここから確認できる。

大阪(地域ID:270000)の天気予報を表示してみる

$ curl -s http://weather.livedoor.com/forecast/webservice/json/v1\?city\=270000 | jq -r '.forecasts[] | select(.dateLabel == "今日").telop'
曇り

API仕様を見ると、もちろん今日の天気以外にも取得できるので、色々と応用できそう。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした