Skip to content

Instantly share code, notes, and snippets.

@iksnae
Created December 7, 2016 16:46
Show Gist options
  • Save iksnae/66c58f577f0bf229ba72a773bcba93da to your computer and use it in GitHub Desktop.
Save iksnae/66c58f577f0bf229ba72a773bcba93da to your computer and use it in GitHub Desktop.
var https = require('https');
const endpoint = "https://spreadsheets.google.com/feeds/list/1DikXO7iDW8PjSE7GBIO-QJdVSXE7yiTuQ0MBwLBoGFM/od6/public/values?alt=json";
https.get(endpoint, function(res) {
var body = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
body += chunk;
});
res.on('end', function() {
jsonResults = JSON.parse(body);
var products = (jsonResults['feed']['entry']).map(function(item){
return {
id: item['gsx$productid']['$t'],
title: item['gsx$producttitle']['$t'],
description: item['gsx$productdescription']['$t'],
price: item['gsx$productprice']['$t'],
image: item['gsx$productimage']['$t']
};
});
console.log(products);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment