我尝试构建启动的代理设置。这里我将 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 中使用 splash?