Get Home Timeline

Jul 5, 2014 at 4:41 PM
Hi, I'm trying to use Tweetinvi to build a simple twitter app for WP. When I try to get the Home many tweets are dupliated. This is the code I'm using:

private async void GetTimeline()
        {
            IHomeTimelineRequestParameters parameters = new HomeTimelineRequestParameters();
            parameters.ExcludeReplies = false;
            if (sinceID != 0) parameters.SinceId = sinceID;
            parameters.MaximumNumberOfTweetsToRetrieve = 200;

            IEnumerable<ITweet> tweets = await TimelineAsync.GetHomeTimeline(parameters);

            TwitterItem tweet = new TwitterItem();

            foreach (var status in tweets)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    tweet.CreatedAt = status.CreatedAt;
                    tweet.ProfileImageSource = status.Creator.ProfileImageUrl.Replace("_normal","");
                    tweet.Text = Helper.RemoveTag(status.Text);
                    //tweet.UserName = status.Creator.Name + " " + status.Creator.ScreenName;
                    tweet.UserName = status.Creator.ScreenName;
                    tweet.Retweeted = status.Retweeted;
                    tweet.Id = status.Id;
                    HomeTimeline.Add(tweet);
                });
            }

            TweetList.ItemsSource = HomeTimeline;
            //sinceID = HomeTimeline.First().Id;
            //Helper.AddSetting("sinceID", sinceID);
        }
public class TwitterItem
    {
        public string UserName { get; set; }
        public string Text { get; set; }
        public string ProfileImageSource { get; set; }
        public DateTime CreatedAt { get; set; }
        public bool Retweeted { get; set; }

        public long Id { get; set; }
    }
Thank you,
Alessandro
Coordinator
Jul 8, 2014 at 12:25 AM
Hi,

Would you please test that you have some duplicated tweet after receiving them from Tweetinvi.
IEnumerable<ITweet> tweets = await TimelineAsync.GetHomeTimeline(parameters);
var toVerify = tweets.GroupBy(x => x.Id);
var duplicatesExist = toVerify.Count() == tweets.Count();
Regards,
Linvi