@Override
protected String postUpload() throws TwitterException {
int statusCode = httpResponse.getStatusCode();
if (statusCode != 200) {
throw new TwitterException("Twipple image upload returned invalid status code", httpResponse);
}
String response = httpResponse.asString();
if (response.contains("<rsp stat=\"fail\">")) {
String error = response.substring(response.indexOf("msg") + 5, response.lastIndexOf("\""));
throw new TwitterException("Twipple image upload failed with this error message: " + error, httpResponse);
}
if (response.contains("<rsp stat=\"ok\">")) {
return response.substring(response.indexOf("<mediaurl>") + "<mediaurl>".length(), response.indexOf("</mediaurl>"));
}
throw new TwitterException("Unknown Twipple response", httpResponse);
}