爬虫程序如何访问论坛 我做了一个爬虫程序,能够爬普通的网页,但是不能爬论坛(比如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了 配置hibernate的问题 role对象引用还是容器出的问题呢? 高手來,如何在jTable中加入一個jButton 希望有人解释一下这个简单程序的循环流程 关于java打印的问题请教!急,在线! 请问怎么样输入1个1位字以上的数,和字符串,有没有现实此功能的函数? 如何学好java请大侠指点,在线等候 菜鸟问题 关于两个类的迷惑:StringReader 和 StringBufferInputStream 请教个java构造器的初始化顺序问题 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了