Reputation: 35
I have created a application where i store tweets to a database. For example i search for a word and tweets come up containing that word and then i store them to the database. I recently read that twitter have indexed all their tweets, so you can trace back to the first tweets ever posted. now i want to create sort of a condition, where i want to get tweets containing a word and from a certain time period.
example:
search word: hello from: 2012-01-03 to: 2014-05-07
is this possible to fix in tweetsharp?
i suspect that i need to declare something here but i dont know what though:
TwitterSearchResult inc = service.Search(new SearchOptions { Q = textBox2.Text, Count = 10000 }); IEnumerable status = inc.Statuses;
Please help. Thanks in advanced
Upvotes: 1
Views: 116
Reputation: 11
public TwitterStatus searchTweets(string targetName, string keyword,DateTime start, DateTime end)
{
IEnumerable<TwitterStatus> list = twitter.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = targetName });
foreach (TwitterStatus item in list)
{
if (item.Text.Contains(keyword) && item.CreatedDate>start&&item.CreatedDate<end)
{
return item;
}
}
return null;
}
Upvotes: 0