Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNithin KV
809 PointsHow to get Google Plus Share count with Node JS
Hi,
I'm trying to get Google Plus share count with Node Js, This is My code:-
var data = querystring.stringify({
"method":"pos.plusones.get",
"id":"p",
"params":{
"nolog":true,
"id": "http://techcrunch.com/2016/06/06/blue-origin-continues-successful-record-setting-year-with-another-nasa-contract/",
"source":"widget",
"userId":"@viewer",
"groupId":"@self"
},
"jsonrpc":"2.0",
"key":"p",
"apiVersion":"v1"
});
var options = {
host: 'https://clients6.google.com/rpc?key=MYAPIKEY',
port: 80,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data)
}
};
var req = https.request(options, function(res) {
console.log('statusCode: ', res.statusCode);
console.log('headers: ', res.headers);
res.on('data', function(d) {
process.stdout.write(d);
});
});
req.end();
req.on('error',function (e) {
console.error(e);
});
I'm getting following error: - Error: getaddrinfo ENOTFOUND