diff options
author | Joe Robinson <joe@lc8n.com> | 2015-12-05 17:51:58 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2015-12-05 17:51:58 +0000 |
commit | ff74f82dff02a8e2676aa30fef85adfea02dfc5a (patch) | |
tree | a497d7ae4651d0728ab09b7dd6b089bb84bcd70e | |
parent | 9b10210a0df92cdc12284b61ca136d4670482012 (diff) |
Print the results
-rw-r--r-- | search.js | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -4,7 +4,6 @@ var url = require('url'); var config = JSON.parse(fs.readFileSync('config.json')); var request = require('request'); -var parsedUrl = url.parse(config.url); var hash = crypto.createHash('sha256').update(config.password).digest('hex'); var cookie = 'password='+hash @@ -13,11 +12,23 @@ var options = { headers: { "Cookie": cookie } }; +var query = 'beans' + function result(error, response, body) { if (!error && response.statusCode == 200) { var results = JSON.parse(body); - console.log(body); + //console.log(results); + search(query, results); } } +function search(query, json) { + + json.forEach(function(item) { + if (item.filename.search(query) > 0) { + console.log(item.filename); + } + }); +} + request(options, result); |