Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: get user latest 3000 tweets

$
0
0
Hi,

Thank you, I really appreciate your feedback.

First of all, please note that with the new version of tweetinvi, the code will now be the following:
privatestatic ITweet[] GetUserTimelineTweets(string userName, int maxNumberOfTweets)
{
    var tweets = new List<ITweet>();

    var receivedTweets = Timeline.GetUserTimeline(userName, 200).ToArray();
    tweets.AddRange(receivedTweets);

    while (tweets.Count < maxNumberOfTweets && receivedTweets.Length == 200)
    {
        var oldestTweet = tweets.Min(x => x.Id);
        var userTimelineParameter = Timeline.CreateUserTimelineRequestParameter();
        // OR
        userTimelineParameter = new UserTimelineParameters();

        userTimelineParameter.MaxId = oldestTweet;
        userTimelineParameter.MaximumNumberOfTweetsToRetrieve = 200;

        receivedTweets = Timeline.GetUserTimeline(userName, userTimelineParameter).ToArray();
        tweets.AddRange(receivedTweets);
    }

    return tweets.Distinct().ToArray();
}
Concerning the second issue, would you please let me know what is the InnerException of your AggregateException.
You can find it by selecting 'ViewDetails' and expanding the InnerException.

Cheers,
Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>