转载:
https://www.javatpoint.com/jsoup-tutorial
Jsoup is a java html parser. It is a java library that is used to parse HTML document. Jsoup provides api to extract and manipulate data from URL or HTML file. It uses DOM, CSS and Jquery-like methods for extracting and manipulating file.
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class FirstJsoupExample{
public static void main( String[] args ) throws IOException{
Document doc = Jsoup.connect("http://www.javatpoint.com").get();
String title = doc.title();
System.out.println("title is: " + title);
}
}