// STATUS [ June 24, 2019 ]: this works /// <summary> /// Gets last X tweets from one Twitter list based on filters set in search and current sinceId /// </summary> /// <remarks> /// Uses tweetinvi to get the list, then tweets in that list, and then filters the tweets /// Note that this DOES filter any of the tweets returned (see previous method for no filters) /// See: https://github.com/linvi/tweetinvi/wiki/Twitter-Lists /// </remarks> /// <param name="listName"> /// The name of the list as defined by the user (e.g., 'Baseball') /// </param> /// <param name="screenName"> /// The screen name / Twitter handle / user name that you want /// </param> /// <param name="includeRetweets"> /// True if you want to include retweets; False if you don't; /// </param> /// <example> /// var tweets = GetTweetsFromTwitterListAfterSinceId("baseball", "mr_baseball", false); /// </example> /// <returns> /// IEnumerable of Tweetinvi.Models.ITweets /// </returns> public IEnumerable <ITweet> GetTweetsFromTwitterListAfterSinceId(string listName, string screenName, bool includeRetweets) { ITwitterList list = TwitterList.GetExistingList(listName, screenName); var currentSinceId = ReadCurrentSinceIdFromTxtFile(); var tweetsParameters = new GetTweetsFromListParameters { SinceId = currentSinceId, IncludeRetweets = includeRetweets, }; IEnumerable <ITweet> tweets = list.GetTweets(tweetsParameters); long newSinceId = currentSinceId; foreach (ITweet tweet in tweets) { if (tweet.Id > newSinceId) { newSinceId = tweet.Id; } } WriteSinceIdToTxtFile(newSinceId); // PrintTweetInfoFromIEnumerableITweet(tweets); return(tweets); }
// STATUS [ June 24, 2019 ]: THIS DOES NOT WORK public IEnumerable <ITweet> GetTweetsFromTwitterListAfterDate(string listName, string screenName, bool includeRetweets, DateTime date) { ITwitterList list = TwitterList.GetExistingList(listName, screenName); var tweetsParameters = new GetTweetsFromListParameters { // Until = new DateTime(2019,06,23), IncludeRetweets = includeRetweets, }; IEnumerable <ITweet> tweets = list.GetTweets(tweetsParameters); // PrintTweetInfoFromIEnumerableITweet(tweets); return(tweets); }