Getting the favorite_count from a Tweet

Apr 14, 2014 at 6:38 PM
I am trying to get the value "favorite_count" that the Twitter API returns as part of the call (https://dev.twitter.com/docs/api/1.1/get/statuses/show/%3Aid). I have confirmed that this endpoint will return the value "favorite_count" by doing some direct tests.

I am using the following syntax to receive a tweet using Tweetinvi:
var myTweet = Tweetinvi.Tweet.GetTweet(210462857140252672);
This returns object of type ITweet. ITweet has a property called RetweetCount, but it does not have one for FavoriteCount. Can the favorite_count be added to this process, or has this been implemented in another manner?
Coordinator
Apr 14, 2014 at 11:13 PM
Edited Apr 14, 2014 at 11:14 PM
Hi there,

The favourites count property is not a property related with a Tweet but a property related with a user.
If you carefully look the json, you will see that it is located with the user node.

This information is already available from the IUser class.
Looking at the API I do not think it is possible to get the number of time a tweet has been favourited.

Hope this helps.
Linvi
Apr 15, 2014 at 12:54 PM
Edited Apr 15, 2014 at 12:55 PM
I think we are discussing different things. Sorry for the long data dump but I wanted to provide all the information I compiled while researching this:

Let's use Tweet 210462857140252672 as an example. You'll see by this link (https://twitter.com/twitterapi/status/210462857140252672) that the Tweet has been favorited 54 times. But, if you you query above using Tweetinvi.Tweet.GetTweet() and take the the information from ITweet.(IUser)Creator.FavouritesCount, the number is 26:

Image

So the ITweet.(IUser)Creator.FavouritesCount is clearly not correct, as it does not match the favorites count on that tweet. Sure enough, if you look at the Twitter API documentation on the User object (https://dev.twitter.com/docs/platform-objects/users), you get this:

Image

Pretty clear that this does not relate to this Tweet but to other tweets the user has favorited. Since Twitter has changed its clients to put favoriting a tweet more in the forefront, capturing the per-tweet favorite count is essential for us.

This favorite tweet count number should be simple to add into Tweetinvi as Twitter is already returning this number as part of the tweet object (https://dev.twitter.com/docs/platform-objects/tweets):

Image

And if you query the API directly, it does indeed return us that the tweet has been favorited 54 times by looking at the favorite_count property, which is a direct sibling to the retweet_count number:
{"created_at":"Wed Jun 06 20:07:10 +0000 2012","id":210462857140252672,"id_str":"210462857140252672","text":"Along with our new #Twitterbird, we've also updated our Display Guidelines: https:\/\/t.co\/Ed4omjYs  ^JC","source":"web","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":6253282,"id_str":"6253282","name":"Twitter API","screen_name":"twitterapi","location":"San Francisco, CA","description":"The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.","url":"http:\/\/t.co\/78pYTvWfJd","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/78pYTvWfJd","expanded_url":"http:\/\/dev.twitter.com","display_url":"dev.twitter.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":2128478,"friends_count":46,"listed_count":12607,"created_at":"Wed May 23 06:01:13 +0000 2007","favourites_count":26,"utc_offset":-25200,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":3491,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/656927849\/miyt9dpjz77sc0w3d4vj.png","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/656927849\/miyt9dpjz77sc0w3d4vj.png","profile_background_tile":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/2284174872\/7df3h38zabcvjylnyfe3_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/2284174872\/7df3h38zabcvjylnyfe3_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/6253282\/1347394302","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":[14927800],"retweet_count":70,"favorite_count":54,"entities":{"hashtags":[{"text":"Twitterbird","indices":[19,31]}],"symbols":[],"urls":[{"url":"https:\/\/t.co\/Ed4omjYs","expanded_url":"https:\/\/dev.twitter.com\/terms\/display-guidelines","display_url":"dev.twitter.com\/terms\/display-\u2026","indices":[76,97]}],"user_mentions":[]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"lang":"en"}
Would it be possible to integrate this tweet favorite_count number into Tweetinvi?
Coordinator
Apr 15, 2014 at 6:42 PM
Hi,

You are totally right. I have missed this property. Thank you for reporting the fact that it was missing.
This feature is now available in Tweetinvi 0.9.2.2.

Regards,
Linvi
Marked as answer by linvi on 4/15/2014 at 11:42 AM