-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsteamcollector.js
More file actions
50 lines (42 loc) · 1.36 KB
/
steamcollector.js
File metadata and controls
50 lines (42 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var http = require('http');
var querystring = require('querystring');
var utils = require('utils');
var apiKey = "";
// print process.argv
// steam API key will be passed in as commandline variable
process.argv.forEach(function (val, index, array) {
console.log(index + ': ' + val);
if (index > 1) {
apiKey = array[2];
console.log(apiKey);
}
});
var arunan_steamID = "STEAM_0:1:14231771";
var tmpStr = "";
var matchHistory = {};
//http.get("http://api.steampowered.com/IEconDOTA2_570/GetHeroes/v1?key=" + apiKey, function (res) {
// console.log("Got response: " + res.statusCode);
// res.on('data', function (chunk) {
// console.log('BODY: ' + chunk);
// });
//}).on('error', function (e) {
// console.log("Got error: " + e.message);
//});
var req = http.get("http://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/v1?key=" + apiKey + "&account_id=76561197988729271", function (res) {
console.log("Got response: " + res.statusCode);
var body = "";
res.on('data', function (chunk) {
body += chunk;
//console.log('BODY: ' + chunk);
});
res.on('end', function() {
//res.writeHead(200, "OK", {'Content-Type': 'text/html'});
var responseBody = JSON.parse(body)
console.log("Got response: ", responseBody);
});
});
req.on('error', function (e) {
console.log("Got error: " + e.message);
});
//matchHistory = JSON.parse(tmpStr);
console.log(matchHistory);