Created
March 6, 2015 22:26
-
-
Save brandonscott/8fd17cd6d1d6f51ba1ac 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('https'); | |
http.get("https://www.bungie.net/Platform/Destiny/1/Account/4611686018433775124/Character/2305843009215890708/?definitions=true", function(res) { | |
console.log("Got response: " + res.keys); | |
var body = ''; | |
res.on('data', function(d) { | |
body += d; | |
}); | |
res.on('end', function() { | |
// Data reception is done, do whatever with it! | |
try { | |
var parsed = JSON.parse(body); | |
} catch (err) { | |
console.error('Unable to parse response as JSON', err); | |
return cb(err); | |
} | |
console.log(parsed.keys); | |
for(var item in parsed.Response.definitions.items) { | |
console.log(parsed.Response.definitions.items[item].itemName); | |
} | |
}); | |
}).on('error', function(e) { | |
console.log("Got error: " + e.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment