Skip to content

Instantly share code, notes, and snippets.

@geNAZt
Created January 19, 2013 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geNAZt/4575430 to your computer and use it in GitHub Desktop.
Save geNAZt/4575430 to your computer and use it in GitHub Desktop.
var httprequest = require('request');
var page = 1;
var maxPage = 50;
function performAfterLoadAttempt(error, response, body) {
"use strict";
//Log the Body
console.log(body);
//Next Page
page++;
//Only request more pages if there is a page you want to get
if (maxPage > page) {
httprequest("http://www.google.com/?p=" + page, performAfterLoadAttempt);
}
}
//Request the first page
httprequest("http://www.google.com/?p=" + page, performAfterLoadAttempt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment