Phantom.js / Casper.js with a rotating proxy?

I have a simple goal: load web pages using phantom.js (out of the box) or casper.js (nice and simple), but use a proxy and rotate it from the list if the current one (for example, loading a web page fails or something like that).

I know that casper.js has the --proxy , but it --proxy user to specify ONE proxy only and use it at runtime.

Question No. 1: how to programmatically rotate proxies on the fly?

I did some research and found this node-requester , but it did not integrate with casper.js . I tried to extract only the proxy function in code , but really did not understand how this works in a nutshell (I'm not that smart, I think).

So, question number 2: is there a simple proxy server rotation implementation that works with either casper.js or casper.js ?

I prefer to use fancy casper.js , although it will burn with phantom.js naked.

+7
source share
1 answer

I had the same problem, I worked with PhantomJS. The solution we ended up with included PhantomJS as a child of the larger Java / Scala server, which then handled the failures and assigned different proxies when needed (by restarting with various parameters in -proxy arg).

+6
source

All Articles