我试图让网站的标题,如果字符串包含标题代码检查是不是“空”。如果它不为空,它将执行其余的代码。Jsoup不会分析我的网站
try {
Document htmlDocument = Jsoup.connect("http://afterlifesolutions.com/theaterstore/app-featured.php").userAgent("Mozilla").get();
htmlContentInString = htmlDocument.title();
if(htmlContentInString != null) {
isNull = false;
}
} catch (IOException e) {
e.printStackTrace();
}
问题是
htmlContentInString = htmlDocument.title();
if(htmlContentInString != null)
应用程序将跳过 'if语句',因为它没有收到称号。但是代码在其他网站上完美运行。
并在html有丝毫不差? – efekctive
你记录了htmlDocument,也许你没有收到任何东西? –
@efekctive这是我试图从http://afterlifesolutions.com/theaterstore/app-featured.php获取数据的网站,是的,它具有标题标签 – Afterlife