tweepy time filtering(python)
I'm using tweepy which is a Python library for Twitter, to get the tweets of an account. problem is- it shows all 开发者_如何学编程the tweets the user has tweeted regardless of the time.
How can I filter it so it only shows tweets tweeted in the past 10 minutes(even somthing like 'tweeted at 5:30' would work)? I've checked the documentation but found nothing helpful.
There's no way of searching by time directly through the API, but you can use API.user_timeline
to get the most recent tweets for a user. You can then store these in a local database and do what you like with them (e.g. select just tweets since a particular time).
I don't know what you mean by "all tweets the user has tweeted" as there's no API method for this that I know of. All the API methods have some kind of restriction on the number of tweets returned.
From the docs you linked to:
API.user_timeline([id/user_id/screen_name][, since_id][, max_id][, count][, page])
Returns the 20 most recent statuses posted from the authenticating user or the user specified. It’s also possible to request another user’s timeline via the id parameter.
精彩评论