私の小さなアプリでは、HTMLをダウンロードするためにフレームワーク "Jsoup"を使用していますが、問題は私のコードがいくつかのURLで動作しないということです。これは私のコードです:なぜJsoupは一部のURLに接続できないのですか?
public static void main(String[] args) {
String html=null;
//Descargamos el html
String url = "http://www.opposingviews.com";
Connection conn = Jsoup.connect(url);
try {
Response resp = conn.execute();
if (resp.statusCode() != 200) {
System.out.println("Error: "+resp.statusCode());
}else{
System.out.println(Thread.currentThread().getName()+" is downloading "+ url);
//html = conn.get().html();
}
}catch(IOException e) {
System.out.println(e.getStackTrace());
System.out.println(Thread.currentThread().getName()+"No puedo conectar con "+ url);
System.out.println("No se puede conectar");
}
などいくつかのURLで動作いけない:
http://www.topix.com
http://www.wittyfeed.com
http://www.wittyfeed.com...
しかし、のような他の人と協力:http://www.google.com, http://www.amazon.es
...
エラーが
org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:590),
org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:540),
org.jsoup.helper.HttpConnection.execute(HttpConnection.java:227),
Practica1.prueba.main(prueba.java:34)
です
この動作の問題は何ですか?
これらのURLにはどのような問題がありますか? – Arpan
エラー 'stackTrace'を追加してください。@RandallDaniBarrientos –
@VikrantKashyapエラー:[org.jsoup.helper.HttpConnection $ Response.execute(HttpConnection.java:590)、org.jsoup.helper.HttpConnection $ Response.execute(HttpConnection .java:540)、org.jsoup.helper.HttpConnection.execute(HttpConnection.java:227)、Practica1.prueba.main(prueba.java:34)]。 –