9
9

More than 5 years have passed since last update.

あるサイトのツイート数・いいね数をterminalで常に表示する

Posted at

今日公開したサイトのシェア数が伸びてるか、
気になって気になって仕事にならないので、シェルスクリプトを書いた。

一度実行して放っておくだけで、
likesとtweetsを表示して、30秒おきに更新してくれます

実行イメージ

実装

とりあえずbashなのでzshとかで動くかは分からず。
brew install jq、必須。

buzz.sh
export url=$1

while :
do
    likes=$(curl "http://graph.facebook.com/$url" -s | jq '.shares')
    tweets=$(curl "http://urls.api.twitter.com/1/urls/count.json?url=$url" -s | jq '.count')

    clear
    echo $url
    echo " - likes:  $likes"
    echo " - tweets: $tweets"
    date

    sleep 30
done

つかいかたは、こうやってURLつけて叩くだけ。

./buzz.sh http://www.kayac.com/

まとめ

  • シェルスクリプトたのしい。
  • elisp化してもいいけど、それはまたなんですね
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9