爬虫程序如何访问论坛 我做了一个爬虫程序,能够爬普通的网页,但是不能爬论坛(比如CSDN),即使我登陆了之后程序也没有权限爬论坛,求好心人给我指条明路,大概是怎么实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以爬别的网站吗?有的论坛是有安全限制的,比方银行的网站至于CSDN为什么不能Crawl,不是很清楚 应该是你的程序写的有问题csdn是可以被爬到的吧,它好象是生成标准静态的 csdn是不可以爬的,应该是有一些前台设置的!不让抓取的 csdn可能不太确切,因为不用登陆也可以访问。我要爬的是需要登录的网站,就比如说要里面的某个页,但获取的页面源代码是登陆页的源码。我想应该是session或者cookie的问题,但不知道实现方式。 如何用java获取某个论坛的cookie呢 HttpClient client = new HttpClient(); client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT); //登录 PostMethod post = new PostMethod( "http://reg.163.com/logins.jsp?type=1&url=http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=16"); NameValuePair username = new NameValuePair("username", "[email protected]"); NameValuePair password = new NameValuePair("password", "519081"); post.setRequestBody(new NameValuePair[] { username, password }); client.executeMethod(post); String responseString = new String(post.getResponseBodyAsString().getBytes( "gbk")); System.out .println("******************************登录页面******************************"); System.out.println(responseString); Cookie[] cookies = client.getState().getCookies(); client.getState().addCookies(cookies); post.releaseConnection();就得到cookie了 java调用kettle transformation 请高手帮忙给我看看gui 这个问题有谁见过,怎么解决的? 怎么在KeyListener里过滤掉字符,只留下数字 关于Java IPC的方式(在线等) 如何使InputStream遍历两次? 请教JAVA编程思想一书中的问题:很菜的问题…………请教高手 请教一个java httpsUrlConnection保持session会话的问题 想参加培训 都有什么培训?ACCP? 还有什么培训? 软件 通讯 网络 方面 关于package的使用 lucene做的检索,关于数字字符串的检索问题! 菜鸟来啦;;;
有的论坛是有安全限制的,比方银行的网站
至于CSDN为什么不能Crawl,不是很清楚
csdn是可以被爬到的吧,它好象是生成标准静态的
client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT); //登录
PostMethod post = new PostMethod(
"http://reg.163.com/logins.jsp?type=1&url=http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&style=16");
NameValuePair username = new NameValuePair("username", "[email protected]");
NameValuePair password = new NameValuePair("password", "519081");
post.setRequestBody(new NameValuePair[] { username, password });
client.executeMethod(post);
String responseString = new String(post.getResponseBodyAsString().getBytes(
"gbk"));
System.out
.println("******************************登录页面******************************");
System.out.println(responseString);
Cookie[] cookies = client.getState().getCookies();
client.getState().addCookies(cookies);
post.releaseConnection();就得到cookie了