aboutsummaryrefslogtreecommitdiff
path: root/init.js
diff options
context:
space:
mode:
Diffstat (limited to 'init.js')
-rw-r--r--init.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/init.js b/init.js
index e806ba0..e9d8a57 100644
--- a/init.js
+++ b/init.js
@@ -33,6 +33,10 @@ module.exports.search = (query, userAgent = "Mozilla/5.0 (X11; Ubuntu; Linux x86
}))
.filter(elem => elem)
)
+
+module.exports.searchRandom = (query, userAgent) => module.exports.search(query, userAgent)
+ .then(results => results[Math.floor(Math.random() * results.length))
+
/*
In case google makes changes, here are some snippets used to reverse engineer the format: