Answers for "find all images on website android"

0

find all images on website android

private static Set<String> findImages(String url) throws IOException {

        Set<String> links = new HashSet<>();

        Document doc = Jsoup.connect(url)
                .data("query", "Java")
                .userAgent("Mozilla")
                .cookie("auth", "token")
                .timeout(3000)
                .get();

        Elements elements = doc.select("img[src]");
        for (Element element : elements) {
            links.add(element.attr("src"));
        }

        return links;

    }
Posted by: Guest on October-03-2021

Code answers related to "find all images on website android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language