@Override public String workInBackground(Void... params) throws TaskException { final String url = String.format( "https://api.weibo.com/oauth2/authorize?client_id=%s&scope=friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog&redirect_uri=%s&display=mobile&forcelogin=true", "2362431378", "http://boyqiang520.s8.csome.cn/oauth2/"); int count = 3; while (count-- >= 0) { try { String js = FileUtils.readAssetsFile("oauth.js", GlobalContext.getInstance()); js = js.replace("%username%", mAccount).replace("%password%", mPassword); Document dom = Jsoup.connect(url).get(); String html = dom.toString(); html = html.replace("</head>", js + "</head>") .replace("action-type=\"submit\"", "action-type=\"submit\" id=\"submit\""); return html; } catch (Exception e) { e.printStackTrace(); } } throw new TaskException( "", GlobalContext.getInstance().getResources().getString(R.string.account_get_html_faild)); }