I want to know a way of getting tweet IDs to keep a check on what tweets have been displayed in the timeline of user in the python app I am making using tweepy.
There doesn't seem to be a way I get extract the tweet IDs or keep track of them. The parameter to keep check is since_id
. Please if anyone could help.
The tweepy
library follows the twitter API
closely. All attributes returned by that API are available on the result objects; so for status messages you need to look at the tweet
object description to see they have an id
parameter:
for status in api.user_timeline():
print status.id
Store the most recent id
to poll for updates.
The max_id
and since_id
are parameters for the api.user_timeline()
method.
Using the tweepy.Cursor()
object might look something like this:
tweets = []
for tweet in tweepy.Cursor(api.user_timeline,
screen_name=<twitter_handle>,
since_id = <since_id>
).items(<count>):
tweets.append(tweet)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With