private void openLogin() throws ClientProtocolException, IOException, HttpException {
String uri = "http://user.qzone.qq.com/" + qq + "/friendvisitor";
HttpResponse response = http.execute(new HttpGet(uri));
if (!Http.isRequestSuccess(response)) {
throw new SocialException("Step 1, open login ui failed.");
}
Document doc = Jsoup.parse(Http.responseToString(response));
loginUi = doc.select("#login_frame").get(0).attr("src");
HttpGet request = new HttpGet(loginUi);
request.addHeader(new BasicHeader("Referer", uri));
response = http.execute(request);
if (!Http.isRequestSuccess(response)) {
throw new SocialException("Step 2, open login ui failed.");
}
doc = Jsoup.parse(Http.responseToString(response));
Matcher matcher =
Pattern.compile("login_sig\\s*:\\s*[\"']([^\"']+)[\"']").matcher(
doc.select("script").get(0).html());
if (!matcher.find()) {
throw new SocialException("Step 3, login page isn't contain login_sig.");
}
loginSig = matcher.group(1);
}