How to get specified number of tweets using Streaming API?



Hi All,

I am working on self-made and self-learning project which will predict the possible US president for 2016 using social media data.
so I started with twitter using search API and Streaming API. These are very great APIs and I love them.

Now what I need is getting specified number of tweets or getting tweets for a specified amount of time. I have looked into the streaming API request parameters and I have not found anything related to my needs.

I am looking for something like” which will get me 500 fresh tweets. or
"" which will get me tweets for 1 hour.

I know search API can do this by giving rpp parameter but I need that for streaming API.

Is there anyway to do that?
I appreciate some help :smile:

Thanks in advance.


Simply close the stream after you have consumed enough tweets.