我已成功将图片上传到twitter。我正在尝试将视频上传到Twitter,但它正在提供错误创建状态。我使用的是twitter4j-core-4.0.4.jar。这是我的代码
protected String doInBackground(String... args) {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthConsumerKey("HuxTZu8Cwc64RgpZIMfx3r8Kk");
builder.setOAuthConsumerSecret("ZOSaJA6APCV8AuvXbrLuR6oyUEUL3YjvwPsyrrpYFVVFii4vjr");
AccessToken accessToken = new AccessToken(pref.getString("ACCESS_TOKEN", ""), pref.getString("ACCESS_TOKEN_SECRET", ""));
Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);
try {
File file = new File(picturePath);
StatusUpdate statusUpdate = new StatusUpdate(messageText.getText().toString());
statusUpdate.setMedia(file);
status = twitter.updateStatus(statusUpdate);
if (status == null) {
// don't know if needed - T4J docs are very bads
System.out.println("tweet null ------- ");
} else {
System.out.println("tweet count ------- " + status.toString());
}
} catch (TwitterException e) {
System.err.print("Failed to search tweets: " + e.getMessage());
// e.printStackTrace();
// DON'T KNOW IF THIS IS THROWN WHEN ID IS INVALID
}
return status.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
这是我得到的错误
W/System.err: Failed to search tweets: 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following). W/System.err: message - Error creating status. W/System.err: code - 189
我是否需要使用twitter4j-media-support-4.0.4发布视频? 任何人都可以帮我解决这个问题。 提前致谢