Skip to content

node-js-libs/node.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

000b51b · Dec 4, 2014
Jul 20, 2011
Mar 19, 2012
May 18, 2013
Mar 12, 2013
Nov 5, 2011
Nov 5, 2011
Apr 18, 2011
Dec 20, 2010
Apr 18, 2012
Nov 16, 2010
Mar 12, 2013
Dec 4, 2014
Nov 16, 2010
May 18, 2013

Repository files navigation

Note: this library is no longer maintained.

I wrote node.io in 2010 when node.js was still in its infancy and the npm repository didn't have the amazing choice of libraries as it does today.

Since it's now quite trivial to write your own scraper I've decided to stop maintaining the library.

Here's an example using request, cheerio and async.

var request = require('request')
  , cheerio = require('cheerio')
  , async = require('async')
  , format = require('util').format;

var reddits = [ 'programming', 'javascript', 'node' ]
  , concurrency = 2;

async.eachLimit(reddits, concurrency, function (reddit, next) {
    var url = format('http://reddit.com/r/%s', reddit);
    request(url, function (err, response, body) {
        if (err) throw err;
        var $ = cheerio.load(body);
        $('a.title').each(function () {
            console.log('%s (%s)', $(this).text(), $(this).attr('href'));
        });
        next();
    });
});

Happy scraping.