1

我尝试获取用户时间线的最后 20 个状态。所以我在互联网上搜索并获得以下代码:

TwitterUser twitterUser = TwitterUser.Show("Username").ResponseObject;
if (twitterUser != null)
{
    UserTimelineOptions userTimelineOptions = new UserTimelineOptions();
    userTimelineOptions.UserId = twitterUser.Id;

    return TwitterTimeline.UserTimeline(userTimelineOptions).ResponseObject;
}
return null;

当我测试它时,我得到以下异常:

Unexpected token when deserializing object: StartObject. Line 1, position 1795.

我不知道出了什么问题,所以我希望你能帮助我!

4

2 回答 2

1

由于Twitterizer已停产,我假设您已移至TweetSharp

TwitterService service = new TwitterService("consumerKey", "consumerSecret");
service.AuthenticateWith("accessToken", "accessTokenSecret");
var options = new ListTweetsOnHomeTimelineOptions();
options.ExcludeReplies = true;
var tweets = service.ListTweetsOnHomeTimeline(options);

对于推特用户:

UserTimelineOptions options = new UserTimelineOptions();
options.ScreenName = "Username";

var tweets = TwitterTimeline.UserTimeline(options).ResponseObject;

Twitterizer 使用 1.0 API,TweetSharp 具有 1.1 twitter API 所需的 oAuth: https ://dev.twitter.com/blog/changes-coming-to-twitter-api

于 2013-06-24T10:53:40.980 回答
0

尝试这个

var twitterService = new TwitterService("consumerKey", "consumerSecret");
twitterService.AuthenticateWith("token", "tokenSecret");
var tweets = twitterService.ListTweetsOnHomeTimeline();
于 2012-05-15T07:47:50.757 回答