the-crawler-base
Base of the-crawlers
Last updated a year ago by okunishinishi .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install the-crawler-base 
SYNC missed versions from official npm registry.

the-crawler-base

Build Status npm Version JS Standard

Base of the-crawlers

Installation

$ npm install the-crawler-base --save

Usage

'use strict'

const { TheCrwl } = require('the-crawler-base')
const theDB = require('the-db')

async function tryExample () {
  let db = theDB({ /* ... */ })

  class MyCrwl extends TheCrwl {
    async crawl (config = {}) {
      /* ... */
      return [
        { resource: 'Site', id: 1, attributes: { /* ... */ } },
        { resource: 'Article', id: 1, attributes: { /* ... */ } }
      ]
    }
  }

  let crwl = new MyCrwl({})
  crwl.setResource('Site', db.resource('Site'))
  crwl.setResource('Article', db.resource('Article'))

  /* ... */
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (4)
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |