Skip to content

Instantly share code, notes, and snippets.

@brandonscott
Created March 6, 2015 22:26
Show Gist options
  • Save brandonscott/8fd17cd6d1d6f51ba1ac to your computer and use it in GitHub Desktop.
Save brandonscott/8fd17cd6d1d6f51ba1ac to your computer and use it in GitHub Desktop.
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