如何解决我无法阅读网站网站:使用jsoup的https://schloss-ahlden.de/katalog.php?mode=kat&pg=2
我无法使用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 举报,一经查实,本站将立刻删除。