How to get tweet ids (from_id, max_id) in tweepy (python)?

I want to know a way to get the tweet IDs to check which tweets were displayed on the user's timeline in the python application that I use with tweepy .

It seems I am not getting the extraction of tweet ids or tracking them. The parameter to check is since_id . Please if anyone can help.

+6
source share
2 answers

The tweepy library follows the twitter API . All attributes returned by this API are available in result objects; therefore, for status messages, you need to look at the tweet description to see that they have an id parameter:

 for status in api.user_timeline(): print status.id 

Save the last polling id for updates.

+4
source

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) 
+1
source

Source: https://habr.com/ru/post/916934/


All Articles