diff options
-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); |