the-crawler-base

2.1.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i the-crawler-base

Weekly Downloads

4

Version

2.1.2

License

MIT

Last publish

Collaborators

  • okunishinishi