Twitter4jTwitter 的 Java 客戶端 API
Twitter4J 是一個非官方的 Twitter API 的 Java 客戶端開發(fā)包,使用 Twitter4j 可以輕松在你的應(yīng)用中集成 Twitter 的服務(wù),主要特點:
- 100% 純 Java
- 支持 Android 平臺和 Google App Engine
- 不依賴第三方開發(fā)包
- 內(nèi)建 OAuth 支持
示例代碼:
// Creates the main object
Twitter twitter = new TwitterFactory().getInstance();
// Ask for a request token
RequestToken requestToken = twitter.getOAuthRequestToken();
// Store the token in session
request.getSession().setAttribute("rt", requestToken);
// Extract the authentication URL
String authUrl = requestToken.getAuthenticationURL();
// Send the Twitter authentication page to the page to create a popup from there
request.setAttribute("auth", authUrl);評論
圖片
表情
