Twitter - Get users live tweets on my website instantly
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开发者_StackOverflow中文版. 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
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.
精彩评论