Extract image src using JSoup

后端 未结 3 1707
無奈伤痛
無奈伤痛 2021-01-12 16:50

I am trying to extract all the image url\'s from this webpage using jsoup? Can anyone offer help on how to do it? All the tags are formatted like this, but I only need the s

3条回答
  •  执笔经年
    2021-01-12 17:08

    You should be able to do something like this to get all img tags:

    for (Element e : doc.select("img")) {
        System.out.println(e.attr("src"));
    }
    

    This should select all img tags and then grab the src attribute and print to the console.

提交回复
热议问题