[Android] HttpClient无法获取网站的全部内容?

时间:2013-07-12 01:28:38

标签: android httpclient httprequest web-crawler

我正在使用Android中的HttpClient。 我已将GET请求发送到网址http://e-info.vn/tvguide/listings/channel/7/296043,但响应与浏览器浏览时收到的内容不同。

这是我的代码

HttpClient client = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url11);
HttpResponse response11 = client.execute(httpget);

回复内容

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><html xmlns="http://www.w3.org/1999/xhtml">      <head>          <link class="component" href="/tvguide/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" rel="stylesheet" type="text/css" /><link class="component" href="/tvguide/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/jquery/jquery.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/events.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/utils.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/json/json-dom.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/scriptaculous/effects.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/JQuerySpinBtn.js" type="text/javascript"></script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/calendar.js" type="text/javascript"></script><link class="component" href="/tvguide/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/calendar.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" rel="stylesheet" type="text/css" /><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/tvguide/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"></script><link class="user" href="/tvguide/a4j/s/3_3_1.GAstylesheet/theme.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" rel="stylesheet" type="text/css" /><link class="user" href="/tvguide/stylesheet/theme.css;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" rel="stylesheet" type="text/css" /><script src="/tvguide/js/jquery.media.js;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" type="text/javascript"></script><script src="/tvguide/js/tvguide.js;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" type="text/javascript"></script><script src="/tvguide/js/jquery.lazyload.mini.js;jsessionid=FD60A14DDEE76AA1F005C83C22A165A7" type="text/javascript"></script><meta name="keywords" />          <meta name="description" />         <meta http-equiv="content-type" content="text/html; charset=utf-8" />           <title>TV Guide :: HTVC L&#7883;ch Ph&aacute;t S&oacute;ng</title>          <link rel="shortcut icon" href="/tvguide/images/favicon.ico" type="image/x-icon" />             <!--                <a:loadStyle src="/stylesheet/nyroModal.css"/>               -->                <!--                <a:loadScript src="/js/jquery.nyroModal-1.6.2.pack.js"/>                 -->                <link href="/tvguide/stylesheet/tvguide_style.css" rel="stylesheet" type="text/css" media="screen" />               <!--[if lte IE 6]>          <link rel="stylesheet" type="text/css" href="/tvguide/stylesheet/tvguide_style_ie6.css"></link>         <![endif]-->            <!-- Google Analaytics -->          <script type="text/javascript">                   var _gaq = _gaq || [];              _gaq.push(['_setAccount', 'UA-21106423-1']);            _gaq.push(['_trackPageview']);                          (function() {             var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';               var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);             })();                     </script>           <script type="text/javascript" language="javascript">

You can visit website at http://e-info.vn/tvguide/listings/channel/7/296043

我不知道如何在javascript运行后获取网站的全部内容。 谢谢你的时间。

1 个答案:

答案 0 :(得分:0)

看看给出here的示例。他们基本上使用带有JavaScript接口的webview来拉出生成的HTML。