Skip to content

Instantly share code, notes, and snippets.

@adamalesandro
Created July 26, 2017 21:44
Show Gist options
  • Save adamalesandro/503f8b11e99e48f69a90c9dd25366a78 to your computer and use it in GitHub Desktop.
Save adamalesandro/503f8b11e99e48f69a90c9dd25366a78 to your computer and use it in GitHub Desktop.
var cheerio = require('cheerio');
var http = require('http');
var _ = require('lodash');
var str = "";
var options = {
host: 'web.archive.org',
port: 80,
path: '/web/timemap/json/http://www.coinbase.com/about'
};
var body = "";
//
// var $ = cheerio.load("<div><p></p></div>");
//
// console.log($.html());
callback = function(response) {
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
// console.log(req.data);
var x = JSON.parse(str);
_.each(x, function(i, j){
// console.log(i);
var item = i;
console.log(i[1]);
});
// your code here if you want to use the results !
});
}
var req = http.request(options, callback).end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment