I need an experienced programmer to optimize the attached .js script. It was written by a beginner and needs some professional care. Right now it consumes too much of CPU and RAM on a Linux based VPS and is not quite finished.
The script right now:
1) It gets executed from command line like this:
phantomjs --proxy=[login to view URL] --cookies-file=/var/cookies/[login to view URL] /var/[login to view URL] [login to view URL] [login to view URL]
All parameters are generated by an external script and are different each time (taken from DB).
2) The command executes phantomjs, but inside the script CasperJS is loaded.
3) The script at the moment visits the first URL, spends there some time and goes to the second URL, waits there, then it ends.
4) There are around 150 instances of the script running at the same time.
__________________________
What the script should be doing?
1) It should actually visit four URLs in a row, not two (all taken from command line as parameters)
2) There should be time (in seconds) passed as command line parameters for each URL, the script would stay (wait, sleep) this amount of seconds on each page
3) BIG CHANGE - instead of simply navigating between pages, i would like the script to simulate clicking <a href=""> tags on each page. What i mean is that somewhere on the first page will be an <a href="[login to view URL]"> tag, and so on. What is the best way to do that? The ideal solution is if i could specify
a) an <a> tag which contains specific href URL
b) or - an <a> tag of specific class or ID
4) There is viewportSize setting somewhere inside, but it doesn't have any effect
If you think you can help with this task, please wirte a few words about you, send a link to your portfolio or justify somehow why you are the best candidate for this task. Thanks a lot!