promise-crawler

0.1.0 • Public • Published

promise-crawler

Promise support for node-crawler (Web Crawler/Spider for NodeJS + server-side jQuery)

npm package

Build Status Coverage Status Greenkeeper badge

Nodejs library for website crawling using node-crawler but on bluebird promises.

Install using npm:

npm i promise-crawler --save

Example:

const PromiseCrawler = require('promise-crawler');
//Initialize with node-crawler options
const crawler = new PromiseCrawler({
  maxConnections: 10,
  retries: 3
});
 
//perform setup and then use it
crawler.setup().then(() => {
  // makes request with node-crawler queue options
  crawler.request({
    url: 'http://example.com'
  }).then((res) => {
    //server side response parsing using cheerio
    let $ = res.$;
    console.log($("title").text());
 
    // destroy the instance
    process.nextTick(() => crawler.destroy())
  })
});
 

Package Sidebar

Install

npm i promise-crawler

Weekly Downloads

8

Version

0.1.0

License

MIT

Unpacked Size

8.31 kB

Total Files

7

Last publish

Collaborators

  • noelgaur