Database Reference
In-Depth Information
Listing 2.9
Adding parameters to the Streaming API
private List<NameValuePair> CreateRequestBody() {
List<NameValuePair> params = new ArrayList<NameValuePair
>();
if(Userids != null&&Userids.size()>0) {
//Add userids
params.add(CreateNameValuePair( "follow" ,
Userids));
}
if (Geoboxes != null&&Geoboxes.size()>0) {
//Add geographic bounding boxes
params.add(CreateNameValuePair( "locations" ,
Geoboxes));
}
if (Keywords != null&&Keywords.size()>0) {
//Add keywords/hashtags/phrases
params.add(CreateNameValuePair( "track" ,
Keywords));
}
return params;
}
Source: Chapter2/streamingapi/StreamingApiExample.java
Key Parameters :The follow 10 parameter can be used to specify the userids
of 5,000 users as a comma separated list.
Rate Limit : Rate limiting works differently in the Streaming API. In each
connection an application is allowed to submit up to 5,000 Twitter userids. Only
public Tweets published by the user can be captured using this API.
2.5
Collecting Search Results
Search on Twitter is facilitated through the use of parameters. Acceptable parameter
values for search include keywords, hashtags, phrases, geographic regions, and
usernames or userids. Twitter search is quite powerful and is accessible by both
the REST and the Streaming APIs. There are certain subtle differences when using
each API to retrieve search results.
2.5.1
REST API
Twitter provides the search/tweets API to facilitate searching the Tweets. The search
API takes words as queries and multiple queries can be combined as a comma
separated list. Tweets from the previous 10 days can be searched using this API.
10 https://dev.twitter.com/docs/streaming-apis/parameters#follow
 
Search WWH ::




Custom Search