我有一个URL,我使用 JSoup 来检索此 URL 指示的网页。
try{
doc = Jsoup.connect(url).timeout(5000).get();
}catch(IOException e){
e.printStackTrace();
}
但我得到以下异常:
Exception in thread "main" java.lang.IllegalArgumentException: Must supply a valid URL
at org.jsoup.helper.Validate.notEmpty(Validate.java:102)
at org.jsoup.helper.HttpConnection.url(HttpConnection.java:48)
at org.jsoup.helper.HttpConnection.connect(HttpConnection.java:24)
at org.jsoup.Jsoup.connect(Jsoup.java:59)