Skip to content

Instantly share code, notes, and snippets.

@chapel
Created October 7, 2010 03:46
Show Gist options
  • Save chapel/614517 to your computer and use it in GitHub Desktop.
Save chapel/614517 to your computer and use it in GitHub Desktop.
var httpAgent = require('http-agent'),
sys = require('sys');
var agent = httpAgent.create('www.bungie.net', ['/stats/reach/playergamehistory.aspx?player=thechapel&vc=2']);
agent.addListener('next', function (err, agent) {
var window = jsdom.jsdom(agent.body).createWindow();
jsdom.jQueryify(window, '/home/wyl/webapps/node/jquery.js', function (window, jquery) {
window.jQuery('a[id$=hypGame]').each(function () {
agent.addUrl('/stats/reach'+this.href);
});
//put subsequent parser here?
});
// Go to the next page in the sequence
agent.next();
});
agent.addListener('stop', function (err, agent) {
sys.puts('the agent has stopped');
});
agent.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment