1
我正在嘗試使用proxy(proxymesh)和scrapy-splash一起使用。我有如下(相關的)代碼使用代理與scrapy-splash
PROXY = """splash:on_request(function(request)
request:set_proxy{
host = http://us-ny.proxymesh.com,
port = 31280,
username = username,
password = secretpass,
}
return splash:html()
end)"""
和start_requests
def start_requests(self):
for url in self.start_urls:
print url
yield SplashRequest(url, self.parse,
endpoint='execute',
args={'wait': 5,
'lua_source': PROXY,
'js_source': 'document.body'},
但它似乎並沒有工作。 self.parse根本不會被調用。如果我將端點更改爲'render.html',我打了self.parse方法,但是當我檢查標題(response.headers)時,我可以看到它不會通過代理。我確認,當我將http://checkip.dyndns.org/設置爲起始url時,在解析響應時看到了我的舊ip地址。
我在做什麼錯?
工作就像一個魅力,感謝的人 – morea030