Created
April 29, 2014 00:41
-
-
Save sethbonnie/11388050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var base_url = 'http://letsrevolutionizetesting.com/challenge.json?id=' | |
function challenge(id) { | |
http.get(base_url+id, function(res) { | |
var result = []; | |
res.on('data', function(chunk) { | |
result.push(chunk); | |
}); | |
res.on('end', function(chunk) { | |
result = JSON.parse(result.join('')); | |
if (result['follow']) { | |
var new_id = result['follow'].match(/\d+/)[0]; | |
console.log(new_id); | |
challenge(new_id); | |
} | |
else { | |
console.log(result); | |
} | |
}); | |
}).on('error', function(e) { | |
console.log("Got error: " + e.message); | |
}); | |
} | |
challenge('756775492'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment