Anax
an empirical spider framework, provides convenience for extracting data from specific websites.
Examples
looking for usage and examples
https://github.com/cooperhsiung/anax-examples
Installation
npm i anax -S
Dependencies
database
- redis
- mongodb
library
- kue, message queue
- request, http client
- cheerio, html parser
- mongoose, ORM
Concepts
models
constructors compiled from your target data's Schema definitions
const Schema = Schema;const itemSchema = ; const Product = mongoose; moduleexports = Product;
flows
workflow, connected by message queue step by step
let flow0 = seed: true name: 'getCateList' { try let cateList = await this; this; catch e console; }; let flow1 = name: 'getItems' { try let itemList = await this; this; catch e ; }; moduleexports = flow0 flow1;
scraps
build request and parse response
moduleexports = home: /* request options*/ { let l = ; ; return l; } getItems: /* request options*/ { let l = ; ; return l; } ;
env config
use .env for eg:
MONGO=mongodb://127.0.0.1:27017/anaxREDIS=redis://127.0.0.1:6379/0PORT=3000