Crawler4J 种子 url 被编码,错误页面是爬虫而不是实际页面

Crawler4J seed url gets encoded and error page is crawler instead of actual page

我正在使用爬虫 4J 来抓取 gitHub 上的用户个人资料,例如我想抓取 url:https://github.com/search?q=java+location:India&p=1 现在我在我的爬虫控制器中添加这个硬编码的 url 像:

字符串url = "https://github.com/search?q=java+location:India&p=1"; controller.addSeed(url);

当爬虫 4J 启动时 URL 抓取的是: https://github.com/search?q=java%2Blocation%3AIndia&p=1

这给了我错误页面。 我该怎么办,我试过给编码 url 但这也不起作用。

我最终不得不对 crawler4J 源代码进行最细微的更改: 文件名:URLCanonicalizer.java 方法:percentEncodeRfc3986

刚刚评论了这个方法的第一行,我就能够抓取并获取我的结果

//字符串=string.replace("+", "%2B");

在我的 url 中有 + 字符,它被 %2B 替换,我收到一个错误页面,我想知道为什么他们在编码整个 URL 之前专门替换了 + 字符.