Twitter streaming api limit count
I am attempting to access the twitter streaming api, however I want to limit the number of replies I get, I tried using the count parameter:
https://user:pass@stream.twitter.com/1/statuses/sample.json?count=100
But I got the error:
Parameter count not allowed in role statusSpritzer
Can anyone explain why this isn't allowed?
The code I am trying to use is this:
$url = "https://user:pass@stream.twitter.com/1/statuses/sample.json";
$fp = fopen($url,"r");
开发者_运维技巧
while($data = fgets($fp)){
$decode = json_decode($data);
for($i = 0; $i < count($decode); $i++){
echo $decode->$i;
}
}
But takes too long to process due to the number of tweets returned, so I am trying to limit the number..
Try changing sample.json
to user_timeline.json
https://user:pass@stream.twitter.com/1/statuses/user_timeline.json?count=100
More info can be found here:
https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
EDIT: It looks like this is not allowed on the Spritzer access level. Count can only be used on the Gardenhose access level.
QUOTE:
Note that the count parameter is not allowed elsewhere, including track, sample and on the default access role.
from https://dev.twitter.com/docs/streaming-api/methods#count
So while statuses/sample allows the count parameter, it does not allow it with the default access level of Spritzer.
精彩评论