Home > Uncategorized > Using #tweetmoasharp to retrieve tweets from a user’s timeline

Using #tweetmoasharp to retrieve tweets from a user’s timeline

logo_tweetmoasharp

Since Tweetsharp is no longer being maintained, there is a fork called tweetmoasharp that is actively maintained. It is pretty much a drop-in replacement for Tweetsharp, with minor differences.

Here’s some code that I wrote to retrieve the tweets from a given user’s timeline

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

var service = new TwitterService(_consumerKey, _consumerSecret);
service.AuthenticateWith(_accessToken, _accessTokenSecret);

var xt = service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = “PetrucciMusic” });
var strJson = service.Response.Response;

This returns tweets from the account https://twitter.com/PetrucciMusic

The TLS1.2 setting may not be needed, depending on what version of .NET you are using, but I was using an old version, which needed it.

 

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment