String googleCaptchaUrl = "http://www.google.com" + RegexUtil.getString("<img src=\"([^\"]*?)\"", rb.getContent());
System.out.println(googleCaptchaUrl);
HttpGet httpget = new HttpGet(googleCaptchaUrl);
CloseableHttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
byte[] b = EntityUtils.toByteArray(entity);
Object object = JOptionPane.showInputDialog(null, "", "输入验证码", JOptionPane.PLAIN_MESSAGE, new ImageIcon(b), null, "");
// 处理重新搜索 1.弹出验证码 输入框 2.使用代理 3.退出
if(object != null){
System.out.println(object.toString());
}
response.close();
httpget.abort();
转载于:https://my.oschina.net/cshuangxi/blog/229402