问题描述
我无法使用jsoup阅读此页面。这是我的代码,但没有图像下载。 我只是在jsoup网站上使用了示例,但没有结果。 请帮我。 谢谢 链接为https://schloss-ahlden.de/katalog.php?mode=kat&pg=2
public void read(){
try {
//Document document = Jsoup.connect(strURL+numPagina).get();
Document document = Jsoup
.connect(https://schloss-ahlden.de/katalog.PHP?mode=kat&pg=2)
.userAgent("Mozilla/5.0")
.timeout(100 * 40000)
.get();
Elements imageElements = document.select("img");
for (Element imageElement : imageElements) {
//make sure to get the absolute URL using abs: prefix
System.out.println("elemento1:"+imageElement.toString());
String strImageURL = imageElement.attr("abs:src");
this.downloadImage(strImageURL,IMAGE_DESTINATION_FOLDER);
}
Elements links = document.select("a[href]");
for (Element imageElement : links) {
//make sure to get the absolute URL using abs: prefix
System.out.println("elemento2:"+imageElement.toString());
//download image one by one
//this.downloadImage(strImageURL,IMAGE_DESTINATION_FOLDER);
}
Elements imports = document.select("link[href]");
for (Element imageElement : imports) {
//make sure to get the absolute URL using abs: prefix
System.out.println("elemento3:"+imageElement.toString());
//download image one by one
//this.downloadImage(strImageURL,IMAGE_DESTINATION_FOLDER);
}
} catch (Exception e) {
System.out.println(" URL NON PRESENTE: " + strURL);
e.printstacktrace();
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)