我正在 Jsoup 中迈出第一步。出去阅读食谱(http://jsoup.org/cookbook/)并尝试了一些未成功的示例。
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public static void main(String[] args) {
Document doc = Jsoup.connect("http://en.wikipedia.org").get();
Elements newsHeadlines = doc.select("#mp-itn b a");
}
我收到以下错误:
Exception in thread "main" java.lang.IllegalArgumentException: usage: supply url to fetch
at org.jsoup.helper.Validate.isTrue(Validate.java:45)
at org.jsoup.examples.HtmlToPlainText.main(HtmlToPlainText.java:26)
我对Java编程很陌生,所以请怜悯:)