1private static Set<String> findImages(String url) throws IOException {
2
3 Set<String> links = new HashSet<>();
4
5 Document doc = Jsoup.connect(url)
6 .data("query", "Java")
7 .userAgent("Mozilla")
8 .cookie("auth", "token")
9 .timeout(3000)
10 .get();
11
12 Elements elements = doc.select("img[src]");
13 for (Element element : elements) {
14 links.add(element.attr("src"));
15 }
16
17 return links;
18
19 }