I want to write bot that searches for tweets after the bot starts. If the tweet has been tweeted before the bot starts working, the bot should ignore it. I have this code right now:
I am using Python and tweepy .
for tweet in tweepy.Cursor(api.mentions_timeline,
since_id=since_id).items():
new_since_id = max(tweet.id, new_since_id)
I don't know how to implement it, I thought about use time function and compare it with the time right now, but I don't know hot to get the time of the tweet.
Twitter's API doesn't allow for searching for tweets by time. You would have to compare the tweet's created_at
attribute to the time at which your bot started.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.