tweetinvi: Problem with GetUserTimeline

I write a code to like n last tweet of a user . this is my code

var user = Tweetinvi.User.GetAuthenticatedUser();

var suser = Tweetinvi.User.GetUserFromScreenName(uname);

if (suser != null)
{
	var timeline = Timeline.GetUserTimeline(suser.Id, n);

	foreach (var item in timeline)
	{
		var success = Tweet.FavoriteTweet(item);
	}
}

sometimes last n tweets returned and sometimes random n tweets returned

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

You can use the UserTimelineParameters class to specify how you want to get the user’s timeline.

Here’s how you can get the user’s timeline WITHOUT replies (this would be the same as if you were looking at the user’s Tweets tab).

var timelineParameters = new UserTimelineParameters
{
          // ExcludeReplies is what controls whether you see the Tweets tab or Tweets & Replies tab
          ExcludeReplies = false,
          MaximumNumberOfTweetsToRetrieve = n
};

var timeline = Timeline.GetUserTimeline(authenticatedUser, timelineParameters);