我正在使用 twitterizer2 尝试获取用户最近的几条推文,然后使用 oAuth 而不是用户的屏幕名称将它们写入表中,但我是 twitterizer 的新手,所以我不知道该怎么做。
var step = Request.QueryString["p"].ToString();
var key = ConfigurationManager.AppSettings["twitterKey"];
var secret = ConfigurationManager.AppSettings["twitterSecret"];
if (step == "1")
{
var reqquest = OAuthUtility.GetRequestToken(key, secret, "http://localhost:2480/Site/Default2.aspx?p=2").Token;
Response.Redirect(OAuthUtility.BuildAuthorizationUri(reqquest, true).AbsoluteUri);
}
else if (step == "2")
{
var token = Request.QueryString["oauth_token"];
var verifier = Request.QueryString["oauth_verifier"];
OAuthTokenResponse getTokens = OAuthUtility.GetAccessToken(key, secret, token, verifier);
var oAuth_token = new OAuthTokens();
oAuth_token.AccessToken = getTokens.Token;
oAuth_token.ConsumerKey = key;
oAuth_token.ConsumerSecret = secret;
oAuth_token.AccessTokenSecret = getTokens.TokenSecret;
TwitterResponse<TwitterStatusCollection> tweets = TwitterTimeline.UserTimeline(oAuth_token);
foreach (var tweet in tweets.ResponseObject)
{
Response.Write(tweet.Text);
}
//TwitterStatus.Update(oAuth_token, "hello");
}
我怎样才能做到这一点 ?谢谢