var horseman = new Horseman({
timeout: 30000,
ignoreSSLErrors: true,
sslProtocol: 'tlsv1',
phantomOptions: {
'proxy' : "proxy.crawlera.com:8010",
'proxy-auth' : "8888"
}
});
var test = horseman
.userAgent('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36')
.open('https://www.amazon.co.uk').html()
.then(function(html){
console.log(html);
});
horseman using PhantomJS from $PATH +0ms
horseman .setup() creating phantom instance 1 +430ms
horseman phantom created +2s
horseman phantom version 2.1.1 +22ms
horseman page created +18ms
horseman phantomjs onLoadFinished triggered success NaN +20ms
horseman injected jQuery +77ms
horseman .userAgent() set Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36 +26ms
horseman .headers() +2ms
horseman .open() https://www.amazon.co.uk +12ms
horseman phantomjs onLoadFinished triggered success 1 +1s
horseman injected jQuery +23ms
horseman .waitForNextPage() +16ms
horseman .waitForNextPage() completed successfully +60ms
horseman .html() undefined +1ms
<head></head><body></body>
返回&#39; <head><body></body></head>
&#39;什么问题 ?我使用ssl-protocol:任何但没有结果。使用了很多userAgent,但它给了我空的html。 PhantomJS:2.1.1,节点:8.1.2