crawlmatic
![npm package](https://nodei.co/npm/crawlmatic.png?downloads=true&downloadRank=true&stars=true)
![Coverage Status](https://coveralls.io/repos/github/AppliedSoul/crawlmatic/badge.svg?branch=master)
Single library for static or dynamic website crawling needs.
A standard wrapper for HCCrawler & node-crawler, based on bluebird promises.
Install using npm:
npm i crawlmatic --save
Dynamic crawling example:
const {
DynamicCrawler
} = require('crawlmatic');
const crawler = new DynamicCrawler({
evaluatePage: (() => ({
title: $('title').text(),
}))
});
crawler.setup().then(() => {
crawler.request({
url: "http://example.com"
}).then((resp) => {
console.log(resp.result.title);
process.nextTick(() => crawler.destroy())
})
});
Static crawling example:
const {
StaticCrawler
} = require('crawlmatic');
const staticCrawler = new StaticCrawler({
maxConnections: 10,
retries: 3
});
staticCrawler.setup().then(() => {
staticCrawler.request({
url: 'http://example.com'
}).then((resp) => {
let $ = res.$;
console.log($("title").text());
process.nextTick(() => crawler.destroy())
})
});