Tweetsharp: Retrieve list of tweets from a specific user
Asked Answered
S

2

7

Couldn't find this in the official TS documentation, other Tweetsharp SO posts, or digging through the library's classes; so I thought I'd ask. How do you retrieve a list of the most recent Tweets from a specific user using Tweetsharp?

You can assume I'm authenticating with an account that is following the user whom's tweets I want to retrieve. I may even be able to authenticate with the account of the user itself.

Slather answered 15/11, 2012 at 0:0 Comment(0)
P
19

Use ListTweetsOnSpecifiedUserTimeline().

For example:

var service = new TwitterService(ConsumerKey, ConsumerSecret);
service.AuthenticateWith(AccessToken, AccessTokenSecret);
var currentTweets = service.ListTweetsOnSpecifiedUserTimeline(screenName:"screen name", page:1, count:100);
Pears answered 16/11, 2012 at 20:59 Comment(3)
Totally missed that method. Thanks Ronald!Slather
how do we know that whether the count is less or more than the 100 ?Sunlit
@Sunlit That number depicts page size. One page will have max 100 records.Designedly
D
1

The method is a little different in updated versions. Its now called ListTweetsOnUserTimeline()

and it your going to pass through options now like so:

  var currentTweets = service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions
                {
                    ScreenName = "yourTwitterHandle",
                    Count = 5,
                });
Deyoung answered 14/9, 2016 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.