user_timeline: Incorrect 'favorited' property on retweets ( retweeted_status )


#1

When getting user_timeline, I have an inconsistency between regular tweets and retweets returned by the API.

The problem I have is as follow:
My user @NicPurple1 favorited tweet 256538358367526912. This was originally a tweet ( 255858881987764224 ) by @EnTherapie, but what my user favorited was the retweet by @TV5Plus.

When my user goes to https://twitter.com/TV5Plus, he sees the little star in the corner showing the tweet is a favorite.
When my user goes to https://twitter.com/EnTherapie, he sees the little star in the corner showing the tweet is a favorite.

So far so good…

Then my user goes to my WebApp and my server attempts to get the @TV5Plus user_timeline in his name ( he authorized my Twitter App ).

If my server gets the original tweet from @EnTherapie, here is what it gets ( I trimmed some of the stuff, if you need the whole thing. let me know ):

[{
    "created_at": "Wed Oct 10 02:34:45 +0000 2012",
    "id": 255858881987764224,
    "id_str": "255858881987764224",
    "text": "@MarilenePilon @LOUBARDE ...Tous les clients sont uniques tout comme leurs souffrances... #enth\u00e9rapie",
    "source": "web",
    "truncated": false,
    "user": {
        "id": 804826434,
        "id_str": "804826434"
    },
    "favorited": true,
    "retweeted": false
}]

As you can see, the tweet is marked as favorited. Unfortunately, this is not the timeline my WebApp displays… I got it only for debugging purposes.

If my server gets the tweets from @TV5Plus, here is what it gets ( I trimmed some of the stuff, if you need the whole thing. let me know ):

[{
    "created_at": "Thu Oct 11 23:34:45 +0000 2012",
    "id": 256538358367526912,
    "id_str": "256538358367526912",
    "text": "RT @EnTherapie: @MarilenePilon @LOUBARDE ...Tous les clients sont uniques tout comme leurs souffrances... #enth\u00e9rapie",
    "source": "\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e",
    "truncated": false,
    "user": {
        "id": 95449863,
        "id_str": "95449863"
    },
    "retweeted_status": {
        "created_at": "Wed Oct 10 02:34:45 +0000 2012",
        "id": 255858881987764224,
        "id_str": "255858881987764224",
        "text": "@MarilenePilon @LOUBARDE ...Tous les clients sont uniques tout comme leurs souffrances... #enth\u00e9rapie",
        "source": "web",
        "truncated": false,
        "user": {
            "id": 804826434,
            "id_str": "804826434"
        },
        "favorited": false,
        "retweeted": false
    },
    "retweet_count": 3,
    "entities": {
    ....
    },
    "favorited": false,
    "retweeted": false
}]</code>

In this case, the tweet is not marked as favorited in either the body of the tweet itself ( and it is tweet 256538358367526912 which is what my user favorited ) or in the tweet inside the retweeted_status property ( which was marked as favorited when I got it directly from the @EnTherapie timeline ).

My application displays the user_timeline of @TV5Plus, my user favorited the tweet in that timeline, but now, my user cannot see this tweet favorited when I refresh @TV5Plus for him.

What am I doing wrong ? Should I use another API to get @TV5Plus tweets ? I like user_timeline and I'd rather continue using it since this is ultimately what I want, but maybe I am missing a parameter. My command was: 

https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=TV5Plus&include_rts=1&trim_user=true&count=2



I have control of the NicPurple1 account if anybody wants me to try anything.

#2

The perspectival boolean attributes in timelines like these are “best effort” – we can’t guarantee that we’ll always provide the correct values – especially in embedded objects such as a retweeted_status within an original status.

If you were to retrieve the original status that was retweeted (not the retweet) and examine it, I imagine you’d find it details the correct perspectival attributes for you, provided the access token used to make the request belongs to a user who has recently favorited that tweet.


#3

Thanks for your very prompt reply. Much appreciated.

You are correct. If I get the original status, I see that it is “favorited”.

If I want to do that, it means that every time I get the user_timeline for @TV5Plus, I need to look at every single status, and for every single status that is a retweet, I need to look up the original status and retrieve its “favorited” property ( using statuses/show/:id function maybe ? ).

In the case of @TV5Plus, the number of retweet is significant so this will surely eat-up the rate-limit of my user.

How does https://twitter.com/TV5Plus know to put the star on the retweet, but I can’t ? Should I use the favorites/list function of the API everytime I request a user_timeline and try to match-up the statuses ?

Any suggestion would be helpful.


#4

Are you sure that your authorization is being accepted when you look at @TV5Plus’ timeline? Are you using API v1.1 or API v1?

Maybe I can help you better if you start from the top of what you’re building and what you’re trying to accomplish from an end-user perspective.


#5

We are working with TV5 ( a television channel ) and they want to have their timeline displayed in a companion application running on an iPad. The user of the application can authorize the LVLPurple Twitter App ( https://dev.twitter.com/apps/3240831 ) to

  • post replies to TV5Plus statuses ( or replies to status retweetd by TV5Plus ),
  • mark statuses as favorite
  • retweet statuses

So, the companion app ( running on the iPad ) presents the TV5Plus timeline to the user and the user can favorite a status. This is where my problem begins.

As the application developer, I want to display the status in such a way that it indicates that the user has favorited the status.

I do indeed use API v1.1 and the statuses I displayed in my first message were the result of “user_timeline.json” calls made by the LVLPurple app for the authenticated user. I planned to get the “favorited” property of the status, but it did not work, so I thought that maybe I should look at the “favorited” property of the “retweeted_status”, but no luck either.

So here I am. I have the statuses, but no way of knowing if my user has favorited it or not.

Any suggestion would be helpful.

Thanks.


#6

Good afternoon,

I am bumping this because I still need information to solve my problem.

The consensus so far is that I cannot get the correct “favorited” information from any retweeted status because Twitter does not insure anything else than ‘best effort’ on this type of information.

So, I need an alternative plan to get the information on whether or not the statuses I get from the user_timeline API ( version 1.1 ) are indeed ‘favorited’ by the authenticated user requesting them.

I redid the steps this afternoon and both ‘favorited’ and ‘retweeted’ statuses from the @TV5Plus timeline using user @NicPurple1.

One of the status was directly written by @TV5Plus and the JSON I got back from the user_timelinee clearly marks it as both ‘favorited’ and ‘retweeted’

{
“created_at”: “Fri Oct 26 04:26:17 +0000 2012”,
“id”: 261685157155717121,
“text”: “Des th\u00e9rapeutes analysent des personnages de la s\u00e9rie #enth\u00e9rapie. Qu’ont-ils \u00e0 dire \u00e0 propos de David et Florence?http://t.co/cEzgpQ0i”,
“source”: “\u003ca href=“http://twitter.com/#!/download/ipad” rel=“nofollow”\u003eTwitter for iPad\u003c/a\u003e”,
“user”: {
“id”: 95449863,
“screen_name”: “TV5PLUS”,
},
“retweet_count”: 1,
“favorited”: true,
“retweeted”: true,
}

The second status was a status originally from @Blancdenoirfilm which was retweeted by @TV5Plus. This time, I tried the /1.1/favorites/create API with both the original status ( 261528193872302082 ) and the retweet status ( 261686644430753792 ) and I get the same JSON below.

{ "created_at": "Fri Oct 26 04:32:12 +0000 2012", "id": 261686644430753792, "text": "RT @Blancdenoirfilm: Ma premi\u00e8re conception-r\u00e9alisation avec @mberthelet : \u00c9rosion\nLancement au @RIDM le 12 nov.\nhttps:\/\/t.co\/qZRG98kX @ ...", "source": "\u003ca href=\"http:\/\/twitter.com\/#!\/download\/ipad\" rel=\"nofollow\"\u003eTwitter for iPad\u003c\/a\u003e", "user": { "id": 95449863, "screen_name": "TV5PLUS", }, "retweeted_status": { "created_at": "Thu Oct 25 18:02:35 +0000 2012", "id": 261528193872302082, "text": "Ma premi\u00e8re conception-r\u00e9alisation avec @mberthelet : \u00c9rosion\nLancement au @RIDM le 12 nov.\nhttps:\/\/t.co\/qZRG98kX @tv5plus\n#erosiontv5", "user": { "id": 172613067, "screen_name": "Blancdenoirfilm", "favourites_count": 0, }, "favorited": false, "retweeted": false, }, "favorited": false, "retweeted": false, }

I used my application to call the favorite/create API and get the user_timeline so I know the same user has done both. I see that the statuses are favorited by @NicPurple1 by logging into this account with a browser and look at the @TV5Plus timeline.

So, if anybody can explain how going to https://twitter.com/TV5Plus while logged in as @NicPurple1 shows the tweets as favorited, but I can’t get the same information when using the user_timeline API, I would be much obliged.

And if it is not possible to get the information from user_timeline because this is a ‘best effort’, then any alternative way to get the information will be welcome. More so if it does not require too many API calls eating up my user’s rate limit.

Thanks.


#7

The inner status object on a retweet is probably never going to accurately reflect the authenticating users relationship with that tweet all of the time. The original tweet, yes, but not the embedded child object. It’s not something we’re currently interested in making scale to 140+ million users.

You have other avenues depending on what APIs you can take advantage of. If you were using User Streams or Site Streams, you could be recording the favoriting and retweeting activity of the authenticating user in real time and maintain your own knowledgebase as to what tweets your user has or has not retweeted.

Alternately, you can make an implementation where the history doesn’t matter. If a user wants to engage with a tweet they’ve already engaged with, you just handle the case there based on the response you get when the user has taken that action.

If you’re using only the REST API, you have the user’s user timeline (a history of the last 3,200 tweets they either tweeted or retweeted) as well as their favorite timeline (a history of the most recently tweeted tweets the user has favorited), which you can use occasional pulling to maintain a partial history for a given user. You also may find it easier to adjust your project requirements such that this is not a factor in your plans.


#8

Thanks for your reply.

I think I will look into the favorite timeline and try to match them with the statuses from the user timelines when I want to display whether or not the status is already favorited.

For the retweeting, I guess I’ll need to look into the user’s own timeline to see if any status from @TV5Plus are in common with his own timeline.

Anyway, thanks for your reply and have a nice week-end !