-
Notifications
You must be signed in to change notification settings - Fork 216
Searches
Twitter gives the ability to developers to search for Tweets and Users. Though you need to be aware that the Tweet results are limited to the past 1 to 2 weeks.
This restriction is quite significant for researchers who will probably consider this sample too limited. In such cases you will need to consider using the streams, especially the SampleStream and FilteredStream.
In order to create a search please read carefully how to format your search query in the Twitter documentation.
// Simple Search
var matchingTweets = Search.SearchTweets("tweetinvi");
We have tried to simplify the access to the search api in Tweetinvi by providing additional parameters that you can set as followed.
var searchParameter = new TweetSearchParameters("tweetinvi")
{
GeoCode = new GeoCode(-122.398720, 37.781157, 1, DistanceMeasure.Miles),
Lang = Language.English,
SearchType = SearchResultType.Popular,
MaximumNumberOfResults = 100,
Until = new DateTime(2015, 06, 02),
SinceId = 399616835892781056,
MaxId = 405001488843284480,
Filters = TweetSearchFilters.Images
};
var tweets = Search.SearchTweets(searchParameter);
Twitter gives less control over User searches and they are therefore quite simple to use in Tweetinvi.
var users = Search.SearchUsers("<user_search>");
User Searches uses pages to iterate over the search result.
// Get users of page number 2
var users = Search.SearchUsers("user_name", page : 2);