Random user agents for google and rotten tomatoes

This commit is contained in:
Dragon Fire
2021-03-18 17:08:12 -04:00
parent 4f8330886b
commit a1bbaed04b
3 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const cheerio = require('cheerio');
const UserAgent = require('user-agents');
const { URLSearchParams, URL } = require('url');
module.exports = class GoogleCommand extends Command {
@@ -57,7 +58,7 @@ module.exports = class GoogleCommand extends Command {
filter: 0,
q: query
})
.set({ 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1' });
.set({ 'User-Agent': new UserAgent().toString() });
const $ = cheerio.load(text);
const links = [];
$('body').find('h3').each((i, h3) => {