So im trying to get Google count results through java without Api . i tried to do it with the Jsoup library. the problem is he cant find the div im looking for called resultStats.
my code:
org.jsoup.nodes.Document doc = Jsoup.connect("https://www.google.co.il/webhp?sourceid=chrome-instant&rlz=1C1LENP_enIL60,jvagazvgsaswgfwf7IL607&ion=1&espv=2&ie=UTF-8#q="+query).get();
Elements info = doc.select("div#resultStats");
You may be looking for something like:
Document doc = Jsoup.connect("https://www.google.co.il/search?q=test").get();
String info = doc.select("div#resultStats").text();
System.out.println(info);
The problem was with your google query url and not the jsoup
code itself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.