Optimizing Twitter Calls

2 views
Skip to first unread message

mage26

unread,
Nov 10, 2010, 2:08:57 PM11/10/10
to Twitter Development Talk
I am currently integrating Twitter with a small social network. I am
using PHP and the twitteroauth library. The idea is that a user can
sync their account to their Twitter. So when they post on their wall,
it will send a tweet and it will post their tweets onto their wall.
Currently, I am gathering user tweets via a PHP script run by cron
that runs like this:

1. go through every user that has connected to their twitter account
2. pull the last 20 tweets for each user.
3. See if any of these tweets are new. If so, deposit into database.

My worry is that we make a call to Twitter for each user connected and
we'll quickly hit our rate limit, even if we get whitelisted. Is there
a more streamlined way to gather people's tweets?

yaemog Dodigo

unread,
Nov 10, 2010, 2:21:28 PM11/10/10
to twitter-deve...@googlegroups.com
On Wed, Nov 10, 2010 at 11:08 AM, mage26 <mag...@gmail.com> wrote:
I am currently integrating Twitter with a small social network. I am
using PHP and the twitteroauth library.  The idea is that a user can
sync their account to their Twitter. So when they post on their wall,
it will send a tweet and it will post their tweets onto their wall.
Currently, I am gathering user tweets via a PHP script run by cron
that runs like this:

1. go through every user that has connected to their twitter account
2. pull the last 20 tweets for each user.
3. See if any of these tweets are new. If so, deposit into database.

You could easily replace this by using the streaming API. No rate limiting no cron job, just works.
--d

mage26

unread,
Nov 11, 2010, 5:09:10 PM11/11/10
to Twitter Development Talk
What's the best method to get statuses from multiple users using
streaming? Do I have to use Site Streams in order to get this
information?

Taylor Singletary

unread,
Nov 11, 2010, 5:11:36 PM11/11/10
to twitter-deve...@googlegroups.com
You'll want to check out the "follow" feature on the "filter" end point of the basic Streaming API: http://dev.twitter.com/pages/streaming_api_methods#follow

Taylor

--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: http://groups.google.com/group/twitter-development-talk

Adam Green

unread,
Nov 11, 2010, 5:19:04 PM11/11/10
to twitter-deve...@googlegroups.com
If you are programming with PHP, I recommend the Phirehose library. It
makes it really easy to use the follow parameter to gather all tweets
for users by user_id:
http://code.google.com/p/phirehose/

Fenn Bailey has done a good job with it. Best of all, you can still
use basic authentication instead of OAuth! You don't run it as a cron
job, but you must be able to run it from a script that is a continuous
background process. If your webhost lets you use the nohup command,
you are all set.

> --

--
Adam Green
Twitter API Consultant and Trainer
http://140dev.com
@140dev

Reply all
Reply to author
Forward
0 new messages