How to run faster a CasperJS script

43 views
Skip to first unread message

Jérémy Brunet

unread,
Sep 22, 2017, 10:29:02 AM9/22/17
to CasperJS
Hello there,

I'm currently executing a CasperJS script to scrap infos from 100K links.

Right now, I've scrapped 3.7K pages in a bit less than 2 hours. At this speed, I have a few hours (or days) ahead of scrapping... 😂

Basically, I'm executing a loop to store every urls in an array and then open each link using thenOpen() before calling 2 custom functions to scrap the infos I'm looking for and store them in a json file.

Is there any tricks to execute such a script faster than I'm doing right now ?

I've tried to write LOC to fill the array with the first link at index 0 then immediately call my functions to scrap. But at the end, this process doesn't work as it first fill the array with the 100K links before scrapping each of them.

Thanks for your help!

Miguel Poegel

unread,
Oct 8, 2017, 6:25:05 PM10/8/17
to CasperJS
Hello, you can disable images and plugins, like this should be much faster, if its still slow because of your slow internet connection, you can use cloud system, please check "https://phantomjscloud.com".

Regards

Ken Soh

unread,
Dec 10, 2017, 11:58:56 AM12/10/17
to CasperJS
Cool trick Miguel!

Another idea you can try is having separate installations for phantomjs and casperjs. and split your automation into parts to run in separate environments. Provided CPU / memory is sufficient to support.
Reply all
Reply to author
Forward
0 new messages