linvi/tweetinvi

Get latest tweet from one user

wibuf opened this issue · 0 comments

wibuf commented

Hello, I'm new to using tweetinvi, and a beginner with c#. I've looked all over for awhile now to try and find some code to only pull the latest tweet from a user but haven't been able to find anything. Can someone assist me and provide some code if possible? I am able to pull a couple hundred tweets and get the text out, however they don't seem to be in order. Thanks

`var userTimeline = await userClient.Timelines.GetUserTimelineAsync("TweetinviApi");

        //Console.WriteLine("Retrieved " + page.Count() + page);

        foreach (var tweet in userTimeline)
        {
            int i = 0;
            if (i == 0){
                newestTweet = tweet.Text;
            }
            i++;
        }
        
        Console.WriteLine("We have now retrieved all the tweets!");
        Console.WriteLine("Newest Tweet: " + newestTweet);

        Console.ReadLine();`