【发布时间】:2015-01-12 08:53:55
【问题描述】:
我有这段代码可以在 tweepy 中创建一个 Stream(我的目标是获取一个人的所有提及的流):
class StreamListener(tweepy.StreamListener):
def on_status(self, status):
print(status.text)
def on_error(self, status_code):
if status_code == 420:
#returning False in on_data disconnects the stream
return False
l = StreamListener()
stream = tweepy.Stream(auth = api.auth, listener=l)
我想知道如何将每个提及与 tweepy.Stream 对象一起使用?
我尝试过类似的方法:
for mention in tweepy.Cursor(stream.filter(track=['@twitter'])).items():
*code*
但这只会创建一个我无法操作或使用的流。我对可以使用任何提及该人的方式感兴趣? 提前致谢。
【问题讨论】: