Skip to content
This repository
Newer
Older
100755 34 lines (25 sloc) 1.219 kb
0608de0b »
2014-01-07 node.io is no more
1 **Note: this library is no longer maintained.**
5fab6c31 »
2010-11-17 Updated README
2
0608de0b »
2014-01-07 node.io is no more
3 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.
bc05fa1d »
2010-11-16 Updated README
4
0608de0b »
2014-01-07 node.io is no more
5 Since it's now quite trivial to write your own scraper I've decided to stop maintaining the library.
7552dac2 »
2010-11-17 Updated README
6
0608de0b »
2014-01-07 node.io is no more
7 Here's an example using [request](https://github.com/mikeal/request), [cheerio](https://github.com/MatthewMueller/cheerio) and [async](https://github.com/caolan/async).
be339bf5 »
2011-01-06 Added high-level scrape example
8
0608de0b »
2014-01-07 node.io is no more
9 ```javascript
10 var request = require('request')
11 , cheerio = require('cheerio')
12 , async = require('async')
13 , format = require('util').format;
be339bf5 »
2011-01-06 Added high-level scrape example
14
0608de0b »
2014-01-07 node.io is no more
15 var reddits = [ 'programming', 'javascript', 'node' ]
16 , concurrency = 2;
17
18 async.eachLimit(reddits, concurrency, function (reddit, next) {
19 var url = format('http://reddit.com/r/%s', reddit);
20 request(url, function (err, response, body) {
21 if (err) throw err;
22 var $ = cheerio.load(body);
23 $('a.title').each(function () {
24 console.log('%s (%s)', $(this).text(), $(this).attr('href'));
be339bf5 »
2011-01-06 Added high-level scrape example
25 });
0608de0b »
2014-01-07 node.io is no more
26 next();
be339bf5 »
2011-01-06 Added high-level scrape example
27 });
0608de0b »
2014-01-07 node.io is no more
28 });
29 ```
e003486b »
2011-03-07 Updated the first example
30
0608de0b »
2014-01-07 node.io is no more
31 The **node.io** domain name is now for sale. [Contact me](mailto:cohara87@gmail.com) if you'd like to make an offer.
f11a5bbf »
2010-11-17 Updated README
32
0608de0b »
2014-01-07 node.io is no more
33 Happy scraping.
Something went wrong with that request. Please try again.