Twitter Search API inconsistency

2009 Nov 29 at 13:43 » Tagged as :xml, search, javascript, twitter, january effect,

In recent weeks, it seems like I spent most of my time finding bugs in the twitter API or third party libraries. Maybe I should get a job in their testing team. This latest bug was discovered in the twitter search API. The from_user and the from_user_id fields do not quite match. Here are some examples:

{"profile_image_url":"http://a1.twimg.com/profile_images/311054570/SecuritySystemPlaza.comLogo_normal.jpg","created_at":"Sun, 29 Nov 2009 12:39:51 +0000","from_user":"SecurityPlaza","to_user_id":null,"text":"GE SECURITY - USA TX6010011 ONLY $78.66 AT WWW.SECURITYSYSTEMPLAZA.COM","id":6168853273,"from_user_id":28463195,"geo":null,"iso_language_code":"en","source":"&lt;a href=&quot;http://apiwiki. twitter.com/&quot; rel=&quot;nofollow&quot;&gt;API&lt;/a&gt;"} Here the from_user field is given as SecurityPlaza and the from_user_id field shows a value of 28463195, if you look at http://twitter.com/users/28463195.xml you will see that the user id of 28463195 corresponds to @ballercoolkid on the other hand http://twitter.com/users/show.xml?screen_name=SecurityPlaza  gives a user id of 56297110 to <a href="http://twitter.com/SecurityPlaza">@SecurityPlaza</a>. So which one of these users sent out the tweet? it was @SecurityPlaza Here is the second example:

{"profile_image_url":"http://a1.twimg.com/profile_images/364463510/logo_normal.jpg","created_at":"Sun, 29 Nov 2009 09:32:56 +0000","from_user":"hindichannels","to_user_id":null,"text":"Sacked opposition party member to spearhead campaign against Genera l Fonseka: Nov 29, Colombo: A member of the main... http://bit.ly/8OBKwS","id":6166287234,"from_user_id":32271894,"geo":null,"iso_language_code":"en","source ":"&lt;a href=&quot;http://twitterfeed.com&quot; rel=&quot;nofollow&quot;&gt;twitterfeed&lt;/a&gt;"} Here the user hindichannels has been associated with the userId of 32271894 where as that ID really belongs to @mrsdraz the correct id for @hindichannels is 61683443 interestingly the results are easily reproducable. Two different searches produced the same errornous output ('fonseka' and 'colombo') I tried these searches between 6:00-7:00pm on Nov 29th by the time that you try these web API calls on your own, the search results would have changed dramatically. So here is a cached copy for you. By the way, the search results may have contained other inaccuracies but these are the only ones that I noticed thanks to some safety checks we have in the Pitupasa code base. The XML search results does not have this problem due to the simple fact that the user ids are not included in it!