tweepyでリアルタイムハッシュタグ検索
この前の python-twitterでハッシュタグ検索 をリアルタイムでやってみる。
使うパッケージは tweepy
パッケージのインストール
$ python --version
Python 2.7.3 -- 64-bit
$ sudo pip install tweepy
$ pip show tweepy
---
Name: tweepy
Version: 2.1
OAuth認証
繰り返しになりますが...
- Consumer key
- Consumer secret
- Access token
- Access token secret
を貰ってきて、別ファイルに書いておく。
Note
tw_key.py
twdict = {
"cons_key": "***********",
"cons_sec": "***********",
"accto_key": "**********",
"accto_sec": "**********"
}
コード
#imas のハッシュタグで検索をかけてみます。
ツイートからのハッシュタグ取り出しもやっています。
実行すると、ターミナルに順次ツイートが表示されます。
$ python twi_realtime.py

僕も視聴中です!