我尝试获取Usertimeline的最后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.
我不知道出了什么问题,所以我希望你能帮助我!
答案 0 :(得分: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);
对于Twitterizer:
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
答案 1 :(得分:0)
试试这个
var twitterService = new TwitterService("consumerKey", "consumerSecret");
twitterService.AuthenticateWith("token", "tokenSecret");
var tweets = twitterService.ListTweetsOnHomeTimeline();