Hello there,
I wanted to use python to search for tweets via the Twitter APIv2. I stumbled across tweepy and searchtweets-v2 but decided to use searchtweets-v2 to get the job done since it is listed in the official documentation (docs/twitter-api/tools-and-libraries/v2)

I am interested in the like_count of the found tweets. Therefore I added “public_metrics” to the “tweet_fields” of my request.

The documentation explaines:
Public metrics: Metrics’ totals that are available for anyone to access on Twitter, such as number of likes and number of Retweets.” (docs/twitter-api/metrics)

But if I look up a tweet in my web browser (= “available for anyone to access”) the like_count doesn’t match. The tweet always has more likes (and higher metrics in general) than the like_count I get from the API. Can someone explain to me why this is?

Thanks for your help in advance :slight_smile:

used access level: Essential

It’s normal to have some discrepancy - the counts are eventually consistent, and i also think the API counts exclude private account likes - and there was also mention of bookmarks being counted towards likes on the site too, so it could be a few things.

Hm, okay :neutral_face:
Do you have any reference to read more about how twitter handles these metrics? Sadly I couldn’t find anything of what you explained in the documentation.

This is a good general overview of the twitter approach: Manhattan, our real-time, multi-tenant distributed database for Twitter scale

Many of Twitter’s applications fit very well into the eventually consistent model. We favor high availability over consistency in almost all use cases, so it was natural to build Manhattan as an eventually consistent system at its core.

And there’s a bunch of others on the engineering blog too - but look for more general terms like “eventual consistency” rather than specific things about the metrics counts because the blog posts describe overall systems rather than individual bits like the counts.

Thanks a lot!

1 Like