Recent Search
Get a count of tweets since Twitter started.
Entity: Counts Entity
Type: CountType.Recent
Parameters/Filters:
Name | Purpose | Type | Required |
---|---|---|---|
EndTime | Date/Time to search to | DateTime | no |
Granularity | Grouping by “minute”, “hour”, or “day” | Granularity enum | no |
Query | Search query | string | yes |
SinceID | Return tweets whose IDs are greater than this | string | no |
StartTime | Date/Time to start search | DateTime | no |
UntilID | Return tweets whose ids are less than this | string | no |
string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo";
Counts? countsResponse =
await
(from count in twitterCtx.Counts
where count.Type == CountType.All &&
count.Query == searchTerm &&
count.Granularity == Granularity.Day
select count)
.SingleOrDefaultAsync();
if (countsResponse?.CountRanges != null)
countsResponse.CountRanges.ForEach(range =>
Console.WriteLine(
$"\nStart: {range.Start}" +
$"\nEnd: {range.End}" +
$"\nTweet: {range.TweetCount}"));
else
Console.WriteLine("No entries found.");
Twitter API: tweets/counts/all