Take the 2-minute tour ×

I'm working on a project which requires counting the number of tweets that meet the parameters of a query. I'm working in Python, using Twython as my interface to Twitter.

A few questions though, how do you record which tweets have already been accounted for? Would you simply make a note of the last tweet ID and ignore it plus all previous? --What is the easiest implementation of this?

As another optimizations question, I want to make sure that the amount of tweets missed by the counter is minimal, is there any way to make sure of this?

Thanks so much.

share|improve this question
add comment

2 Answers

You may consider using sets! they prevent duplicates.

some pseudocode:

s = set()
for tweet in tweets:
share|improve this answer
add comment

considering the case of similar tweets and retweets, I would recommend making a semantic note of the whole tweet, extracting the text part of each tweet and doing a dictionary lookup. but tweet id is more simpler with significant loss, usage as noted above.

share|improve this answer
add comment

Your Answer


