java - Crawler4j 警告 "invalid cookie header"导致爬网程序无法获取该页面

标签 java cookies web-crawler crawler4j

我在非常业余的设置中使用crawler4j从网站上抓取文章(以及用于内容抓取的boilerpipe)。在某些网站中,爬虫运行得非常流畅。但在其他情况下,它只是无法获取网站(尽管我仍然可以使用 jsoup 获取数据)。

碰巧从同一个站点中,某些页面正在被获取,而其他页面则没有。它发出此警告,然后完全跳过该页面:

Feb 11, 2016 5:05:31 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: visid_incap_688991=7KCcJ/TxTWSEzP9k6OFX2eZqvFYAAAAAQUIPAAAAAAAHVw5Tx4mHCf3VQHK63tAN; expires=Fri, 09 Feb 2018 15:00:14 GMT; path=/; Domain=.banglatribune.com". Invalid 'expires' attribute: Fri, 09 Feb 2018 15:00:14 GMT

I can understand from this warning that crawler4j is doing something regarding the cookie (it's using CookieSpecs.DEFAULT and I can't change it in any way).

有没有其他方法可以在不使用crawler4j的情况下管理httpclient?

有什么办法可以改变crawler4j中的cookie选项吗?

PageFetcher.java in crawler4j creates the httpclient and handles all the cookie options.

或者我应该使用另一个可以为在 cookie 中使用错误格式的网站定制的爬虫吗?

任何帮助将不胜感激。

最佳答案

HTTPClient 是从 crawler4j 源内部处理的,因此在使用此库时无法更改或操作有关 httpclient(包括 cookie 规范)的任何配置。

关于java - Crawler4j 警告 "invalid cookie header"导致爬网程序无法获取该页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35337920/

相关文章:

java - java 8中的.net列表分组依据?

java - Selenium Internet Explorer 11 - 连续警报 - 第二个警报上的文本为空

java - 如何使用 Selenium WebDriver 选择组合框值,其中它是具有组合框角色的 div

javascript - 如何在node.js中处理post数据后设置cookie头

apache - Hadoop、HBase 和 Apache Nutch 兼容版本

java - 使用 @autowired 到 DI 后得到一个 null 对象

javascript - 如何使用jquery Cookie?

java - tomcat服务器关闭时如何删除cookies?

java - 修改Nutch爬虫解析页面并从爬取的页面中获取某些数据

python - 如何避免 python 蜘蛛程序中出现重复的下载网址?