Closed Tomato6966 closed 3 years ago
Sorry for the delay, I haven't used this module for a long time :-) I will update it in the upcoming days. Your problem is probably linked to the fact that Google now displays a cookie consent popup window.
its alright, i made my own scraper
const Discord = require("discord.js"); const serp = require("serp"); const request = require("request"); //CLIENT const client = new Discord.Client() const config = { "token": "your token in here", "prefix" : "!" } client.login(config.token); client.on("ready", () => console.log("BOT IS READY")) client.on("message", msg => { if(!msg.guild || msg.author.bot || !msg.content.startsWith(config.prefix)) return; const args = msg.content.slice(config.prefix.length).trim().split(/ +/g); const cmd = args.shift().toLowerCase(); if(cmd === "ping") return msg.reply(
My Ping is: \
${client.ws.ping}ms`); else if(cmd === "google") { if(!args[0]) return msg.reply(
please add your search term: `${config.prefix}google Hello world``) var options = { host : "google.com", qs : { q : args.join(" "), }, num : 10, retry : 3, }; serp.search(options).then(links => {console.log(links[0].url.replace("/url?esrc=s&q=&rct=j&sa=U&url=", ""))
} else return msg.reply( | --> googles smt````);
})
UNKNOWN CMD! These are all of my cmds: \n\
``${config.prefix}ping | --> shows you my latency\n${config.prefix}google