Mottl / GetOldTweets3

A Python 3 library and a corresponding command line utility for accessing old tweets
MIT License
367 stars 126 forks source link

How to get the number of LIKES in each tweets #66

Open ismail-mebsout opened 4 years ago

ismail-mebsout commented 4 years ago

Hello,

Is it possible to get the number of likes in each tweet? It is very useful to visualize the top tweets for a certain hashtag.

Thank you very much!

monchiestevez commented 4 years ago

According to the readme, using the tweet model, you can get retrieve the amount of favorites (likes) as an integer.

Example:

# Example 2 - Get tweets by query search
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('covid19').setSince("2020-01-01").setUntil("2020-04-20").setLang('en').setMaxTweets(1)

tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
print(tweet.favorites)
monchiestevez commented 4 years ago

Also, you can store the amount of likes for each tweet, and order them from most liked to least liked to visualize the top tweets. You can do the same for other variables from the tweet model such as retweets.