views:

247

answers:

1

Hello guys,

I was checking out the stocktwits.com website. While signing up I provided them with my twitter username. Now whenever I tweet and if my tweet contains $ and a stock ticker symbol - it instantly appears on Stocktwits.com

I am interested in implementing something similar in my website. Just wanted an understanding of how this would work. This is how I'm assuming it would work at a high level:

1) On my website - require users to provide their twitter usernames 2) Run a cron job every few minutes to pull the latest tweets for each of the usernames provided using something like http://twitter.com/statuses/user_timeline/username.xml

I've tried Stocktwits and they updates are almost instantaneous - so it does not appear like they are checking for updates every few minutes.

  • What are the best ways to implement this solution Thanks
+3  A: 

They are probably using Twitter's search API to search for $ sign. After that, if they want to show only twits from their users, all they need to do is filtering what they're showing with their user database.

If you don't want to do search queries every few minutes, you can use Twitter's Streaming API.

Pablo Santa Cruz
And how are the updates so instant - are they making a call every few seconds
Gublooo
@Gublooo you can use streaming API. I updated the answer to reflect that.
Pablo Santa Cruz
Also doing a search on $ on the entire twitter feed would not be as efficient as first searching for their users tweets and then searching for $ symbol within those right?
Gublooo
oh ok Let me take a look at the Streaming API - didn't know about that - Thanks
Gublooo
@pablo - thanks for the info - So I looked at the Streaming API - and I believe using that I can follow users and get their live tweets - so I can pass the user Id's of my users. Seems like a good solution to me - but in their docs they have mentioned that default user can follow only 400 user ids and shadow role can follow 80000 - not sure what that is
Gublooo

related questions