I want to search the tweets of past week using tags.
For example, if I write "Google" in the text box, the code should return every tweet which has the word "Google" in it and has been posted within past 7 days, regardless of who tweeted it.
I am able to get the data of the past hour, but I want to read the data of the past week. here is my code
public static void GetTweet(String query)
{
DateTime Pre = DateTime.Now.AddDays(-7);
SearchOptions options = new SearchOptions(){
SinceDate = Pre,
PageNumber=pageNumber,
NumberPerPage =100
};
TwitterResponse<TwitterSearchResultCollection> searchResult = TwitterSearch.Search(query,options);
while (searchResult.Result == RequestResult.Success && pageNumber < 10)
{
foreach (var tweet in searchResult.ResponseObject)
{
Console.WriteLine(tweet.Text, tweet.CreatedDate);
pageNumber++;
searchResult = TwitterSearch.Search(query, options);
}
}
}