I'm a newbie in programming, but i hope you can help me with my problem. I'm trying to analyse tweets using tweepy/python/stream.api and R (the statistic program).
Right know the stream listener is working, but I can't use the output...
This is the script I'm running:
import tweepy
consumer_key="..."
consumer_secret="..."
access_key = "..."
access_secret = "..."
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)
class CustomStreamListener(tweepy.StreamListener):
def on_status(self, status):
print status.text
def on_error(self, status_code):
print >> sys.stderr, 'Encountered error with status code:', status_code
return True # Don't kill the stream
def on_timeout(self):
print >> sys.stderr, 'Timeout...'
return True # Don't kill the stream
sapi = tweepy.streaming.Stream(auth, CustomStreamListener())
sapi.filter(track=['...'])
As a result, I don't get the full tweets (only the first 50 characters), and I can't see the time when it was tweeted. How can i fix this, and is it possible to somehow "print" the output into an Excel file?