我想提取200条包含网址http://on.fb.me/的推文。我试过这个:
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
ckey = 'just some'
csecret = 'secret keys'
atoken = 'you should'
asecret = 'invalidate now'
class listener(StreamListener):
def on_data(self, data):
print data
return True
def on_error(self,status):
print status
auth = OAuthHandler(ckey,csecret)
auth.set_access_token(atoken, asecret)
twitterStream = Stream(auth, listener())
twitterStream.filter(track=["http://fb.me"]
当我运行此代码时,光标一直闪烁,没有任何反应。