CasperJs, Node, and the Raspberry Pi
So I've been working on a pet project today, getting my Raspberry Pi to be a dedicated screen-scraping machine.
I'm still in the middle of getting things working, so I'll be updating this post as I figure more stuff out. This post is intended to be a log for myself and hopefully a helpful resource for others.
I'm using the Raspbian Jessie image provided by Raspberry Pi. To create and backup my SD card images I'm using the excellent ApplePi Baker app. It provides a GUI wrapper around some gnarly command line tools to flash images to the Raspberry Pi SD card.
Installing CasperJS and Phantom
I've run into issues with the 1.9.8 version of phantom compared to the 2.0 version on my laptop. Finding a compiled binary of 2.0 has proven to be quite difficult. So I'm on hold for now until I can get a 2.0 version running.
Since I'm using my Pi headless, I'm configuring everything over ssh. Sometimes this just doesn't work well. I've found VNC to be a nice solution in those cases. This post has simple instructions for getting a VNC server up and running on your Pi. I use Chicken VNC as the client on my Mac to connect to the Pi's server.
The Pi is slow. Really slow. I've found adding some
casper.waits to my code have helped iron out some random errors.