Bogeyman Ruby Client
Bogeyman is Ruby client for Bogeyman.js which is server application providing headless crawling of heavy javascript web sites via REST API.
Installation
You can install it via gem
gem install bogeyman
Or you can put it in your Gemfile
gem 'bogeyman', '~> 0.0.6'
Usage
At first make sure that your server is installed and running
npm install -g bogeyman # install it
bogeyman # start it
For more information about server follow this link
So when your server is set up then you can do
require 'bogeyman'
client = Bogeyman::Client.new
response = client.post 'http://example.com', param1: 'abc'
response = client.get 'http://example.com'
p response.code
p response.body # whole html as string
p response.html # Nokogiri instance of body
Or if you want to use existing cookies
client = Bogeyman::Client.new(
cookies: [
{
name: "test",
value: "test",
domain: "yuna.sk",
path: "/path",
httponly: false,
secure: false,
expires: 1405164630,
},
]
)
Or if you require advanced options
client = Bogeyman::Client.new(
host: 'bogeyman.com', # default: 'localhost'
port: 12345, # default: 12345
proxy: '127.0.0.1:41414', # default: nil
proxy_type: 'socks5', # default: 'http'
proxy_auth: 'user:passwd', # default: nil
disk_cache: true, # default: false
max_disk_cache_size: '1024', # default: nil
ssl_protocol: 'any', # default: 'sslv3'
ssl_certificates-path: '...', # default: system default
web_security: true, # default: false
cookies: []
)
You can also set proxy explicitly by set_proxy method
client.set_proxy 'localhost', 31313
For more information you can take a look at Bogeyman.js or PhantomJS API Reference.
License
This library is distributed under the Beerware license.