# ask google jet lag ```java= import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class test { public static void main(String[] args) { String responseString = ""; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpHost proxy = new HttpHost("113.254.114.24",8197); // 元朗 proxy httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy); HttpGet httpGet = new HttpGet("http://www.google.com.tw/search?q=日本時差"); HttpResponse response = httpClient.execute(httpGet); responseString = EntityUtils.toString(response.getEntity()); Document document = Jsoup.parse(responseString); Element element = document.getElementsByClass("BNeawe").get(3); System.out.println(element.text()); } catch (Exception e) { System.out.println(responseString); e.printStackTrace(); } } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up