Parsing Html content using Jsoup

后端 未结 1 1677
渐次进展
渐次进展 2021-01-25 16:55

This is my HTML source

             
  • Item 1
    111&
  • 1条回答
    •  清歌不尽
      2021-01-25 17:37

      Try this for easy parsing using jsoup:

      // To parse the html page
      Document doc = Jsoup.connect("http://www.website.com").get();
      Document doc1 = Jsoup.parse("First parse" + " 

      Parsed HTML into a doc.

      "); String content = doc.body().text(); // To get specific elements such as links Element links = doc.select("a[href]"); for(Element e: links){ System.out.println("link: " + e.attr("abs:href")); }

      To learn more, visit Jsoup Docs

      0 讨论(0)
    提交回复
    热议问题