A very adaptable web crawler framework. Impossible to kill.
- Install the module via npm:
npm install roach
Single Document, Roach Filter, Multiple Transports
var Roach = ;var roach = ;// Use multiple transports with default optionsroach;// Add a job to get all the 'a' links from google.comroach;// run the jobroach;
Multiple Documents, Roach Filter, Multiple Transports
var Roach =Proxy = RoachProxy;var roach = ;// Use multiple transports with default optionsroach;var proxy = '' 'google' ;proxy;
Reading From File System, Custom Proxy & Parser Filters
Note: Custom filters need to end with
.js (crappy I know, but it was tricky to automatically resolve your filters vs. our custom ones.)
var Roach =Proxy = RoachProxy;var roach = ;var config = roach;roach;var proxy = '/tmp' 'awesomesauce' ;// Use the Roach directory filter and a custom filter// to grab every .txt file the '/tmp' directoryproxy;
Roach has multiple transports that can be used to save your data somewhere. They all have default options that are specific to the individual transport. The options can be overridden by passing in an options object like so:
All the transports should adhere to the same basic interface and they pretty simple to implement so feel free to write your own!
This is as simple as it gets. It just spits stuff out to console. Useful for debugging or just piping results to a file.
name : 'logger'
For saving to file system.
path : pathname: 'file'filename: 'data:'
Saving to a single collection. No replica set support at the moment. Single DB only.
protocol : 'mongo'name: 'mongodb'host : 'localhost'port : '27017'db: 'roach'collection: 'roach'safe: true
Obviously, saving to RabbitMQ.
protocol : 'amqp'name: 'rabbitmq'host : 'localhost'port : '5672'exchange :name: 'roach'options:durable : trueconfirm : truelogin: 'guest'password: 'guest'vhost: '/'routingKey: '#'
Redis (in progress)
Saving to Redis. Right now this is tightly coupled to our own use case, so it currently saves a key to a set and then saves the key + a score + the data to a sorted set. We plan on abstracting so that you can determine your save method or override the default.
protocol : 'redis'name: 'redis'host : 'localhost'port : 6379
We provide a few helpful utility libraries wrapped up in the
Roach.Utils namespace. At the moment they are:
Roach.Utils.request-> Helpful utilities for making http requests
Creative Commons 3.0 - Attribution Sharealike
You can remix, copy or use for both commercial and non-commercial products and services but you need to provide attribution for the original work in the source code to "PetroFeed Inc.". You must also share the original or any derivative under the same license. A description of the license can be found here.
Proudly brought to you by PetroFeed.