Getting timelines for multiple users


#1

Hi,
I’m a newcomer to the Twitter API so I’m hoping that I’ve overlooked something obvious. In case it matter, I’m using the PHP ‘TwitterAPIExchange’ library.

I want to do a bit of basic data mining through Twitter. My specific project is to take user’s following list, count the number of tweets within a given time period and display the results on a graph. At the moment, I think I’m hitting the rate limit as I call statuses/user_timeline once for each person the user is following (eg, I’m following 190 people, and I think the rate limit is 180). Is there any way around this?

My code looks something like this:

        $statusTimelineUrl= 'https://api.twitter.com/1.1/statuses/user_timeline.json';
    	foreach ($users as $currentUser)
    	{
		$getfield = "?user_id=" . $currentUser ['id_str'] . '&trim_user=true&exclude_replies=false&include_rts=true';
                $twitter= new TwitterAPIExchange($settings);
		$twitter->setGetfield ( $getfield );
		$twitter->buildOauth ( $statusTimelineUrl, 'GET' );
		$jsonText= $twitter->performRequest();
    		
    		$tweets= json_decode($jsonText, true);
    		
    		$count= 0;
    		foreach ($tweets as $currentTweet)
    		{
    			$time= strtotime($currentTweet["created_at"]);
    			if ($time > $cutoffTimestamp) {
    				$count++;
    			}
    		} // end loop tweets
    		
    		$tweetCount[$currentUser["screen_name"]]= $count;    		
    	} // end loop $users

#2

bump, anybody have any ideas about this?