0

Splash 不适用于 Privoxy/Tor。虽然

  • Privoxy/Tor 在浏览器中工作。
  • Splash 可与普通代理一起使用。yield SplashRequest(url, self.parse_func, args={'wait': 2.5, 'proxy': 'http://a_proxy_address:port', }).
  • Scrapy without Splash 通过 Privoxy 工作。yield scrapy.Request(url, callback=self.parse_func, meta={'proxy': 'http://127.0.0.1:8118'}))。

在脚本 Splash 中给出错误 502。

如果尝试在浏览器中打开 Splash page localhost:8050,它会给出错误页面: Privoxy was unable to socks5t-forward your request http://localhost:8050/ through localhost: SOCKS5 request failed

/etc/privoxy/配置:

forward-socks5 / localhost:9050 .
forward-socks4 / localhost:9050 .
forward-socks4a / localhost:9050 .
forward-socks5t / localhost:9050 .

我也尝试添加/etc/privoxy/config以下行,但没有帮助。

forward localhost  .
4

1 回答 1

2

您的问题是您正在使用 splash 并将其传递给 localhost 代理。当 splash 尝试使用127.0.0.1:8118时, this 指的是 splash 容器本身,并且没有任何东西在其中运行。所以它失败了。

两种可能的解决方案

在主机网络上运行启动

sudo docker run --net host scrapinghub/splash

给代理IP

如果您的笔记本电脑/PC 有192.168.0.101来自路由器的 IP,则使用

yield SplashRequest(url,
self.parse_func, args={'wait': 2.5, 'proxy':
'http://192.168.0.101:8118', })
于 2017-08-25T05:17:18.953 回答