Search code examples
pythontwittertweepy

How do I get the number of likes on a tweet via tweepy?


I have a tweepy tweet object and I can see and print its favorite_count and retweet_count but I do not see a like_count when I print the member variables of the object. Knowing the number of favorites seems a lot less relevant for typical use cases of working with a tweet as it is far more common to like something on Twitter than to favorite it.

I am able to do something like this:

api = tweepy.API(auth)
tweet = api.get_status(tweet_id)
print(tweet.retweet_count)
print(tweet.favorite_count)

but doing

print(tweet.like_count)

Does not work and I can't see any alternative. Furthermore when I google things like "tweepy get like count of a tweet" nothing relevant pops up which just seems odd. How can I do this?


Solution

  • Favourites are the same as likes. There is no difference. Clicking on a heart on Twitter increments the favourite count.

    https://twittercommunity.com/t/hearts-and-likes-are-live/55642