scraperjs icon indicating copy to clipboard operation
scraperjs copied to clipboard

DynamicScraper from the example not doing anything

Open jeremythille opened this issue 8 years ago • 6 comments

I'm trying out the examples exactly as written. The HackerNews example with scraperjs.StaticScraper works perfectly fine and I get a big array of strings.

However, replacing Static with Dynamic doesn't do anything. At all. The execution just ends with no error. I tried debugging it, adding try/catch statements, but I still get no error. I tried "npm install phantom" too, but it doesn't change anything for scraperjs. I have no idea what's wrong here.

jeremythille avatar Mar 07 '16 15:03 jeremythille

+1

abinashmeher999 avatar Mar 11 '16 23:03 abinashmeher999

@jeremythille @abinashmeher999 It will work, if you downgrade phatomjs to 1.9.8 version as mentioned in #53

skibish avatar Mar 27 '16 16:03 skibish

I downgraded to phantomjs 1.9.8 but it still does not work on Mac OS 10.11.5.

QuentinRoy avatar May 20 '16 02:05 QuentinRoy

Removing the folder node_modules and install again did the trick for me.

Nosion avatar Jun 11 '16 21:06 Nosion

Downgraded to 1.9.8 and no luck

brennanerbezniksc avatar Oct 21 '16 22:10 brennanerbezniksc

Check your version of node. It looks like DynamicScraper doesn't work with newer node versions. node 7.9 didn't work for me, but 4.8.2 worked fine.

I'm building a docker image to encapsulate the correct version of node/phantom/scraperjs, as it appears there's a pretty specific set of versions that are required to make this all work.

This Dockerfile worked for me:

FROM node:4.8

WORKDIR /scraperjs
RUN npm install scraperjs
RUN npm install -g '[email protected]'
ENV NODE_PATH=/scraperjs/node_modules

then:

# assumes dynamic HN example is in 'hn.js'
$ sudo docker build -t coopernurse/scraperjs .
$ sudo docker run --rm -v `pwd`:/code coopernurse/scraperjs node /code/hn.js

coopernurse avatar Apr 29 '17 17:04 coopernurse