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.

 

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: