First off, I'm doing a contest where users must tweet a message 'just entered #cool-contest, more info at http://unique/url/239843' and I'm basically doing a search using the api:
http://search.twitter.com/search.atom?q=%40twitterapi+OR+%40twitter
Sample entry element:
<entry>
<id>tag:search.twitter.com,2005:5266369259</id>
<published>2009-10-29T19:03:56Z</published>
<link type="text/html" href="http://twitter.com/mytweetsnl/statuses/5266369259" rel="alternate"/>
<title>THE_REAL_SHAQ: Shaq-A-Claus is coming to town! Check out my “Join Shaq Give Back” challenge, coming.. http://bit.ly/1OVKHR</title>
<content type="html">THE_REAL_SHAQ: <b>Shaq-A-Claus</b> is coming to town! Check out my “Join Shaq Give Back” challenge, coming.. <a href="http://bit.ly/1OVKHR">http://bit.ly/1OVKHR</a></content>
<updated>2009-10-29T19:03:56Z</updated>
<link type="image/png" href="http://a3.twimg.com/profile_images/298078521/twitter_normal.gif" rel="image"/>
<twitter:geo>
</twitter:geo>
<twitter:source><a href="http://twitterfeed.com" rel="nofollow">tw开发者_C百科itterfeed</a></twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>mytweetsnl (MyTweets.nl)</name>
<uri>http://twitter.com/mytweetsnl</uri>
</author>
</entry>
I'm basically trying to search all retweets of the initial user ( me ) and tracking the string '#cool-contest' and 'http://unique/url/239843' from the content element, then inserting the entries into a local database, but before I actually insert the entry I also need to determine whether said user is a follower or not, and this is why I need the user id to cross reference with followers:
http://twitter.com/followers/ids.xml?screen_name=101010
Is there an extra parameter I'm missing so I can actually see the user ID? If not would the only way be to parse the twitter URI, so grab the username after 'twitter.com/user' from the author
element and feed it as a name parameter?
http://twitter.com/followers/ids.xml?screen_name=mytweetsnl
I'm just a little hesistant because I'm not sure if the screen name is reliable since it may be updated in the future.
My initial questions about this project ( if you want more info ): Tweet Contest logic ( Twitter )
Use the json format of the Twitter search API.
Curently, the user_ids from the search API are not the same as the Twitter user IDs used everywhere else. This is a common problem.
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.
If you use the search API and parse the json you can get the from_user_id property and therefore their user id
http://search.twitter.com/search.json?q=google
精彩评论