1

I need twitter data for my project, but with streaming api I am able to get only 15 min window frame.Hence a very smaller sample space.
I have a written code in python as follows

import tweep
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener

consumer_key = "T---------------------------------------f"
consumer_secret = "N-------------------------------------------d"
access_key = "3-------------------------------------------------------u"
access_secret = "M-----------------------------------------X"

# authorize
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)
api = tweepy.API(auth)

# get streaming tweets by hashtag
hashtag = '#madebygoogle'
class MyListener(StreamListener):
     def on_data(self, data):
        try:
            print data
            return True
        except BaseException as e:
            print('Error on_data: %s' % str(e))
        return True
    def on_error(self, status):
        print(status)
        return True

twitter_stream = Stream(auth, MyListener())
twitter_stream.filter(track=[hashtag])  

How can I increase the rate of tweets??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.