tweepy使用,public streamを垂れ流す
#coding:utf-8 import tweepy import sys consumer_key = '' consumer_secret = '' access_key = '' access_secret = '' class StreamListener(tweepy.StreamListener): def on_status(self, status): if sys.argv[1].decode('utf-8') in status.text: print (status.user.screen_name+' : '+status.text.encode('utf-8')) auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) stream = tweepy.Stream(auth, StreamListener()) stream.sample()
コピペですが.
http://newbienewbie.wordpress.com/2011/04/16/twitterのstreaming-apiを試してみる/
スクリプトに引数として単語を渡すとそれを含むtweetをpublic streamから拾ってくる.
cmdでのリダイレクト
D:\>cat test.txt a
D:\>echo add >> test.txt D:\>cat test.txt a add
'>>'で追記
D:\>echo overwrite > test.txt D:\>cat test.txt overwrite
'>'で上書き
Virtual Box にGuest Additions をインストール {ホスト:Win7,ゲスト:Ubuntu}
デバイス(D) → Guest Additions のインストール
で駄目だった.
mount自体はしてるみたいなので見に行く.
cd /media/cdrom0 vim AUTORUN.INF
どうやらオートランがWindows OS 用のプログラムを参照してるらしいのでLinux 用を直接起動.
sudo ./VBoxLinuxAdditions.run
なんか色々出て終了 → リブート