aboutsummaryrefslogtreecommitdiff
path: root/init.js
diff options
context:
space:
mode:
Diffstat (limited to 'init.js')
-rw-r--r--init.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/init.js b/init.js
index d8ac681..e806ba0 100644
--- a/init.js
+++ b/init.js
@@ -2,13 +2,8 @@ const fetch = require("node-fetch")
const cheerio = require("cheerio")
const jsonic = require("jsonic")
-const debug = arg => {
- console.log(arg)
- return arg
-}
-
module.exports.search = (query, userAgent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0") =>
- fetch("https://www.google.com/search?tbm=isch&q=" + encodeURIComponent(debug(query)), {headers: {"User-Agent": userAgent}}).then(res => res.text()).then(data =>
+ fetch("https://www.google.com/search?tbm=isch&q=" + encodeURIComponent(query), {headers: {"User-Agent": userAgent}}).then(res => res.text()).then(data =>
cheerio.load(data, null, false) // parse HTML
("script") // find script tags
.toArray() // convert cheerio list to array