summaryrefslogtreecommitdiff
path: root/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'search.js')
-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);