summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-05 17:51:58 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-05 17:51:58 +0000
commitff74f82dff02a8e2676aa30fef85adfea02dfc5a (patch)
treea497d7ae4651d0728ab09b7dd6b089bb84bcd70e
parent9b10210a0df92cdc12284b61ca136d4670482012 (diff)
Print the results
-rw-r--r--search.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/search.js b/search.js
index 2e99287..fda4604 100644
--- a/search.js
+++ b/search.js
@@ -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);