I'm trying to get google search engine results in this way:
Document document = Jsoup.connect("https://www.google.com/search?q=example").userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11 Firefox/19.0").timeout(3000).get();
Elements temp = document.select("div.rc");
but I'm getting the before you continue to google page, which doesn't allow me to get the information i want.
I also tried this:
try {
Map<String, String> cookies = Jsoup.connect("https://www.google.com/search?q=example").execute().cookies();
Document document = Jsoup.connect("https://www.google.com/search?q=example").userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11 Firefox/19.0").timeout(3000).cookies(cookies).get();
Elements temp = document.select("div.rc");
} catch (IOException e) {
// error handling
}
to connect with those cookies, but it doesn't work too. Is there a way to get around that annoying page?
Thanks in advance