nutch:通过goagent代理爬行

时间:2012-07-09 11:02:27

标签: proxy nutch

我正在学习Nutch的抓页。但是有一个问题我无法解决。 我想通过本地代理服务器抓取页面,地址是127.0.0.1:8087。服务器运行良好(我的FireFox可以很好地使用它)。在Nutch-conf文件conf / nutch-site.xml中,我添加了一些属性如下:

http.agent.host - > 127.0.0.1

http.proxy.port - > 8087

我的本地服务器不需要任何身份验证。

Nutch可以成功运行但不通过代理请求。

感谢。

2 个答案:

答案 0 :(得分:4)

只需将这些属性添加到nutch-site.xml(用正确的值替换XXXX)

<property>
  <name>http.proxy.host</name>
  <value>XXXXXX</value>
  <description>The proxy hostname.  If empty, no proxy is used.</description>
</property>

<property>
  <name>http.proxy.port</name>
  <value>XXXXXXXX</value>
  <description>The proxy port.</description>
</property>

如果你需要身份验证:

<property>
  <name>http.proxy.username</name>
  <value></value>
  <description>Username for proxy. This will be used by
  'protocol-httpclient', if the proxy server requests basic, digest
  and/or NTLM authentication. To use this, 'protocol-httpclient' must
  be present in the value of 'plugin.includes' property.
  NOTE: For NTLM authentication, do not prefix the username with the
  domain, i.e. 'susam' is correct whereas 'DOMAIN\susam' is incorrect.
  </description>
</property>

<property>
  <name>http.proxy.password</name>
  <value></value>
  <description>Password for proxy. This will be used by
  'protocol-httpclient', if the proxy server requests basic, digest
  and/or NTLM authentication. To use this, 'protocol-httpclient' must
  be present in the value of 'plugin.includes' property.
  </description>
</property>

答案 1 :(得分:1)

我遇到了类似的问题。不确定它是否相同。我从终端设置路径并运行Nutch。它工作正常。我没有在Nutch做任何其他额外的设置。它适用于Ubuntu但不知何故它不适用于Mac。如果有效,请告诉我。

    export http_proxy=http://server-ip:port/
    export http_proxy=http://127.0.0.1:8087/
    export http_proxy=http://proxy-server.mycorp.com:8087/