Reputation: 11011
I'm having a problem with integrating the Twitter API into my website to make a small feed of my latest tweets. I call the JSON API using this URL:
http://twitter.com/statuses/user_timeline.json?screen_name=<my username>&count=2
I get a proper feed, and when I parse it it's completely fine. Though I noticed that after I retweeted a tweet from my account, the JSON feed started showing one less entry at the bottom (I had 2 tweets, now it's showing 1).
I thought that it was because the API was now returning two tweets one of which was my retweet, and had popped out the oldest tweet, though the retweet was not showing up.
After inspecting the actual JSON code returned by the API, I discovered that there's no trace of my oldest tweet (the one that popped away) nor of the new retweet. The only shown tweet is my second one, the one before I retweeted.
Does anyone know how to solve that? I don't want the stream on my website to show retweets, so this is okay, but I also don't want my retweets to make the real tweets disappear.
Thanks in advance.
Upvotes: 3
Views: 3108
Reputation: 3933
Twitter has provided the include_rts
parameter. The count
seems to be the count including retweets, even if you don't have include_rts
enabled (which in my opinion is quite lame/annoying).
http://twitter.com/statuses/user_timeline.json?screen_name=<my username>&count=2&include_rts=true
Upvotes: 4
Reputation: 47833
count
is not a promise of how many tweets will be returned. It is more a max count. If you want to increase your chances of receiving two normal tweets set count
to 10 or 20 and only display the latest two.
Upvotes: 3