viewsource和viewparsed_为什么爬虫程序抓取同一个页面的url和view source看到的url不同?...

为什么爬虫程序抓取同一个页面的url和viewsource看到的url不同?,请高手指点,谢谢!具体如下:源程序:publicstaticvoidmain(String[]args){System.getProperties().put("proxySet"...

为什么爬虫程序抓取同一个页面的url和view source看到的url不同?,请高手指点,谢谢!具体如下:

源程序:

public static void main(String[] args) {

System.getProperties().put("proxySet", "true");

System.getProperties().put("proxyHost", "10.158.140.91");

System.getProperties().put("proxyPort", "80");

connect("http://www.amazon.cn/s/ref=pd_sl_6x34at35kw_b?ie=UTF8&n=658619051&page=1");

}

private static void connect(String urlString) {

URL url = new URL(urlString);

connection = (HttpURLConnection)url.openConnection();

int responseCode = connection.getResponseCode();

String contentType = connection.getContentType();

// Note: contentLength == -1 if NOT KNOWN (i.e. not returned from server)

int contentLength = connection.getContentLength();

URL parentUrl = null;

PageInfo p = new PageInfo(url,parentUrl,contentType,contentLength,responseCode);

InputStreamReader rdr = new InputStreamReader(connection.getInputStream());

BufferedReader in = null;

in = new BufferedReader(rdr);

String inputLine;

while ((inputLine = in.readLine()) != null) {

System.out.println(inputLine);

}

打开页面 viewsource时,看到的连接是

新东方·考研英语词汇词根+联想记忆法 俞敏洪 群言出版社 (2008-02出版)

通过程序得到的连接是:

新东方·

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值