Пример #1
0
        // 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);
        }
Пример #2
0
        // STATUS [ June 23, 2019 ]: this works
        // not sure if this is really needed - but good to include for testing purposes
        public IEnumerable <IUser> GetSelectedNumberOfMembersOfTwitterList(string listName, string screenName, int countOfMembersToGet)
        {
            ITwitterList        list    = TwitterList.GetExistingList(listName, screenName);
            IEnumerable <IUser> members = list.GetMembers(countOfMembersToGet);

            // PrintListMemberInfo(members);
            return(members);
        }
Пример #3
0
        // STATUS [ June 24, 2019 ]: this works
        /// <summary>
        ///     Gets list of twitter IUsers that are members of a Twitter list
        /// </summary>
        /// <remarks>
        ///     Uses tweetinvi to get ITwitterList list
        ///     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>
        /// <example>
        ///     var members = GetAllMembersOfTwitterList("baseball","mr_baseball");
        /// </example>
        /// <returns>
        ///     IEnumerable of IUsers
        /// </returns>
        public IEnumerable <IUser> GetAllMembersOfTwitterList(string listName, string screenName)
        {
            ITwitterList        list            = TwitterList.GetExistingList(listName, screenName);
            int                 listMemberCount = list.MemberCount;
            IEnumerable <IUser> members         = list.GetMembers(listMemberCount);

            PrintListMemberInfo(members);
            return(members);
        }
Пример #4
0
        // 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);
        }
 public ListEventArgs(ITwitterList list)
 {
     List = list;
 }
 public ListUserUpdatedEventArgs(ITwitterList list, IUser user)
     : base(list)
 {
     User = user;
 }
Пример #7
0
 public ListEventArgs(ITwitterList list)
 {
     List = list;
 }
Пример #8
0
 public ListUserUpdatedEventArgs(ITwitterList list, IUser user)
     : base(list)
 {
     User = user;
 }
Пример #9
0
 private static IEnumerable <IUser> GetUsersInList(ITwitterList list)
 {
     return(list.GetMembers(list.MemberCount));
 }