Twitterの検索APIについて、やっかいな問題にぶちあたりました。(2010年4月29日現在)
APIの結果に、ツイートのfrom_user_idとto_user_idという値が入っています。誰の発言したツイートか(from_user_id)と誰宛のツイートか(to_user_id)という数値で、当然twitterのユーザーIDが入ってくるものだと思っていたのですが、どうもバグがあるらしく、時折いい加減な数字が返ってきてしまいます。。
GET search http://dev.twitter.com/doc/get/search
Warning: The user ids in the Search API are different from those in the REST API (about the two APIs). This defect is being tracked by Issue 214. This means that the to_user_id and from_user_id field vary from the actualy user id on Twitter.com. Applications will have to perform a screen name-based lookup with the users/show method to get the correct user id if necessary.
この問題はすでに報告されていて、現在追跡中です。 ちなみにこのバグは2008年のクリスマスイブに報告されているので・・・。
対応としてはfrom_userとto_userにtwitterのscreen_name(僕のアカウントならfunc09みたいな)が入っているので、それを users/show APIを使って調べてね。とのこと。
twitterはAPIの制限もあるし、全部問い合せるわけにもいかず、超困るんですけど・・。
とりあえず検索APIのfrom_user_idとto_user_idは信用するなということですね。
関連記事