How to parse simple html code with jsoup? android

后端 未结 2 1507
臣服心动
臣服心动 2021-01-23 00:39

This is the part of my html code

                    

dr James – opiekun naukowy

2条回答
  •  遥遥无期
    2021-01-23 01:34

    There are various ways to extract data using jsoup. Check http://jsoup.org/cookbook/extracting-data/selector-syntax.

    In your case to get the text and image sources you could do like

    Document doc = Jsoup.connect(url).get();
    for(Element div : doc.select("div")){
        System.out.println(div.text());
        for(Element img : div.select("img")){
            System.out.println(img.attr("src"));
        }
    }
    

提交回复
热议问题