我尝试构建飞溅的代理设置。在这里,我将TOR或Polipo端口地址分配给set_proxy
,但行不通。我有504错误:
function main(splash)
local host = "localhost"
local port = 8123
--local type = "SOCKS5"
splash:on_request(function (request)
request:set_proxy{host, port}
end)
splash:go(splash.args.url)
splash:wait(0.5)
local image = assert(splash:png{render_all=true})
return {png=image}
end
"""
url = 'https://www.torproject.org/'
在polipo.config(9150是tor端口):
socksParentProxy = localhost:9150
diskCacheRoot=""
#socksProxyType = socks5
在settings.py中:
HTTP_PROXY = 'http://127.0.0.1:8123'
DOWNLOADER_MIDDLEWARES = {
'thefork.middlewares.RandomUserAgentMiddleware': 400,
'thefork.middlewares.ProxyMiddleware': 410,
我该如何修复此问题,或者有一种更简单的方法可以使用TOR?
我相信的问题在您安装的中间件中。尝试根据每个请求手动设置代理。这就是我解决问题的方式。它试图代理每个请求,当您发送请求以飞溅的请求时,它试图通过代理和失败进入您的本地主机。