使用Jsoup解析网页时未收到正确的HTML

时间:2014-11-24 01:18:48

标签: java jsoup

我最近发现了一个API链接,用于显示有关我在网站上的帐户的信息。我想定期从链接中提取信息。 这是网页的图片以及其中的HTML:

{"loggedin":true,"notifications":[{"points_for_tokens":false,"uID":"","date":"2014-11-23 19:15:58","source_id":,"type":1,"event_type":2000,"status

HTML与上面的代码完全相同。

我正在尝试使用Jsoup检索此页面,使用以下代码:

Document doc = Jsoup.connect(url).get();
System.out.println(doc.html());

但唯一的输出是:

<html>
 <head></head>
 <body>
  <table border="0" cellpadding="4" cellspacing="0"> 
   <thead> 
    <tr> 
     <th>loggedin</th>
     <th>notifications</th>
     <th>adminnotifications</th>
     <th>newsearchenginenotificationcount</th>
     <th>newsignupnotificationcount</th>
     <th>newsearchnotificationcount</th>
     <th>newredeemednotificationcount</th>
     <th>newfblikeenotificationcount</th>
     <th>newfbconnectnotificationcount</th>
     <th>newadminactivitynotificationcount</th>
     <th>newsweepstakesearchnotificationscount</th>
     <th>newtrialpaynotificationcount</th>
     <th>newsweepstakeentriesnotificationcount</th>
     <th>newpointsvisitnotificationcount</th>
     <th>newsweepstakevisitnotificationcount</th>
     <th>newnotificationcount</th>
     <th>adminnotificationcount</th>
     <th>newnonadminnotificationcount</th>
     <th>userperks</th>
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td userperks="Array" newnonadminnotificationcount="0" adminnotificationcount="0" newnotificationcount="0" newsweepstakevisitnotificationcount="0" newpointsvisitnotificationcount="0" newsweepstakeentriesnotificationcount="0" newtrialpaynotificationcount="0" newsweepstakesearchnotificationscount="0" newadminactivitynotificationcount="0" newfbconnectnotificationcount="0" newfblikeenotificationcount="0" newredeemednotificationcount="0" newsearchnotificationcount="0" newsignupnotificationcount="0" newsearchenginenotificationcount="0" adminnotifications="Array" notifications="Array" loggedin="1"></td>
     <td>1</td>
     <td>Array</td>
     <td>Array</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>0</td>
     <td>Array</td>
    </tr> 
   </tbody> 
  </table>
 </body>
</html>

我也通过使用Desktop.getDesktop.browse(url)检查了URL,它显示页面正常,但我无法解析它。我可以提供您可能需要的任何其他信息。谁能告诉我为什么这可能无法正常工作?

0 个答案:

没有答案