Searching Twitter

Perform a search.

Entity: Search
Type: SearchType.Search (optional)
Parameters/Filters:
Name Purpose Type Required
Count Number of tweets to retrieve for each page. Max is 100. int no
GeoCode Tweets within the Radius from a specified Latitude and Longitude. Specify as "latitude,longitude,radius". string no
IncludeEntities Omits entities when set to false. Default is true. bool no
Lang Language to return tweets in as defined by ISO-639-1. string no
Locale Language used in query. ja is currently the only supported language other than en. Defaults to en. string no
MaxID Return tweets prior to or equal to this ID. ulong no
Query Search query. Can contain search operators defined at Twitter Search API docs. string yes
ResultType Specify whether tweets should be Popular, Recent, or Mixed; defaults to recent. ResultType no
SearchLanguage Language of tweets. int no
SinceID Return tweets later than this ID. ulong no
Type Search type. string no
Until Tweets up to this date, YYYY-MM-DD. string no
v3.0 Example:
            var searchResponse =
                await
                (from search in twitterCtx.Search
                 where search.Type == SearchType.Search &&
                       search.Query == "\"LINQ to Twitter\""
                 select search)
                .SingleOrDefaultAsync();

            if (searchResponse != null && searchResponse.Statuses != null)
                searchResponse.Statuses.ForEach(tweet =>
                    Console.WriteLine(
                        "User: {0}, Tweet: {1}", 
                        tweet.User.ScreenNameResponse,
                        tweet.Text));
v2.1 Example:
            var srch =
                (from search in twitterCtx.Search
                 where search.Type == SearchType.Search &&
                       search.Query == "LINQ to Twitter" &&
                       search.Count == 7
                 select search)
                .SingleOrDefault();

            Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query);
            srch.Statuses.ForEach(entry =>
                Console.WriteLine(
                    "ID: {0, -15}, Source: {1}\nContent: {2}\n",
                    entry.StatusID, entry.Source, entry.Text));

Twitter API: search/tweets

Last edited Nov 29, 2013 at 3:42 AM by JoeMayo, version 17