Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Return recent n number of tweets using TweetSharp

I am trying to get recent 200 tweets using TweetSharp but it is returning 12 for some reason.

var service = new TwitterService(
                 _consumerKey,
                 _consumerSecret,
                 tokenClaim,
                 tokenSecret
                 );

IAsyncResult result = service.BeginListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200}
IEnumerable<TwitterStatus> tweets = service.EndListTweetsOnUserTimeline(result);

Any ideas why would that be? Thanks

Update

Following How to fetch maximum 800 tweets from ListTweetOnHomeTimeline() method of TweetSharp?

 IAsyncResult result =
            _twitterService.BeginListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200 });
        IEnumerable<TwitterStatus> tweets = _twitterService.EndListTweetsOnUserTimeline(result).ToArray();

        var tweet2 = _twitterService.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200, MaxId = tweets.Last().Id });

        return tweet2;

tweet2 is empty.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

TweetSharp is an old library and no longer maintained. It is known to have authentication problems, but big chance is that you're bumping against an other issue due to Twitter API changes. Just don't waste your time trying to fix it.

I suggest you to use the more up-to-date library Linq2Twitter which is also available on NuGet.

With LinqToTwitter your code would look like:

static async Task<List<Status>> ListTweetsOnUserTimeline(string screenName)
{
    var auth = new SingleUserAuthorizer
    {
        CredentialStore = new SingleUserInMemoryCredentialStore
        {
            ConsumerKey = consumerKey,
            ConsumerSecret = consumerSecret,
            AccessToken = accessToken,
            AccessTokenSecret = accessTokenSecret
        }
    };

    using (var context = new TwitterContext(auth))
    {
        var tweets = await (from tweet in context.Status
                            where tweet.Type == StatusType.User &&
                                  tweet.Count == 200 &&
                                  tweet.ScreenName == screenName
                            select tweet)
                            .ToListAsync();
        return tweets;
    }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!