lib/scraper.js
function scrapePage(cb, pages, links) {
  links = links || [];
  pages = pages || basePages.slice();

  var url = pages.pop();

  jsdom.env({
    url: url,
    scripts: ['http://code.jquery.com/jquery.js'],
    done: function(err, window){
      if (err) return cb(err);
      _getLinks(window, links);
      if (!pages.length) return cb(null, links);
      scrapePage(cb, pages, links);
    }
  });
}
function scrapePage(cb, pages, links) {
  links = links || [];
  pages = pages || basePages.slice();

  var url = pages.pop();

  jsdom.env({
    url: url,
    scripts: ['http://code.jquery.com/jquery.js'],
    done: function(err, window){
      if (err) return cb(err);
      _getLinks(window, links);
      if (!pages.length) return cb(null, links);
      scrapePage(cb, pages, links);
    }
  });
}
function scrapePage ( cb , pages , links ) { links = links || [ ] ; pages = pages || basePages . slice ( ) ; var url = pages . pop ( ) ; jsdom . env ( { url : url , scripts : [ 'http://code.jquery.com/jquery.js' ] , done : function ( err , window ) { if ( err ) return cb ( err ) ; _getLinks ( window , links ) ; if ( ! pages . length ) return cb ( null , links ) ; scrapePage ( cb , pages , links ) ; } } ) ; }
Scrape a page

@param {Function} cb
@param {Number} pages - max number of pages
@param {String} links - the links accumulated thus far
@return undefined
@api public
Scrape a page