[英]Jsoup parsing stuck in inifinite loop
I am using Jsoup to parse some web retrieved pages. 我正在使用Jsoup解析一些Web检索的页面。 For some reasons Jsoup gets into an infinite loop when trying to parse the content at http://higherperspectives.com/keanu-reeves-life/
由于某些原因,Jsoup在尝试解析http://higherperspectives.com/keanu-reeves-life/上的内容时陷入无限循环
Here is the code used: 这是使用的代码:
Document document = Jsoup.connect(searchResult.get("link"))
.timeout(500).followRedirects(false).validateTLSCertificates(false)
.userAgent("Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36")
.maxBodySize(0).get();
Elements classElements = document.select("*:containsOwn(${owlSearchTerm.get("class")})");
Elements relationElements = document.select("*:containsOwn(${owlSearchTerm.get("relation")})");
Elements individualElements = document.select("*:containsOwn(${owlSearchTerm.get("individual")})");
The connect method never ends. connect方法永无止境。 The connection is successfully established but I guess the problem appears when Jsoup creates the Document object.
连接已成功建立,但我想Jsoup创建Document对象时出现问题。
Is there a way to skip a situation like this? 有没有办法跳过这种情况?
I dont really understand why you are using the maxBodySize(0) option. 我真的不明白为什么您要使用maxBodySize(0)选项。 I 've tried it without it and it runs fine and returns the Document.
我尝试了没有它的情况,它运行良好并返回了Document。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.