bda-research / node-crawler

Web Crawler/Spider for NodeJS + server-side jQuery ;-)

Home Page:http://node-crawler.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I use node-crawler with JSDOM?

kerolloz opened this issue · comments

The documentation doesn't mention the way of using jsdom with jquery. Is it injected in the result parameter passed to the callback function like cheerio in $.

const Crawler = require("crawler");
const jsdom = require('jsdom');

const cl = new Crawler({
    jQuery: jsdom,
    maxConnections : 100,
    callback : function (err, res, done) {
      const $ = res.$;
      const urls = $('#list a');
      console.log(urls)
    }
});