mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Random user agents for google and rotten tomatoes
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const UserAgent = require('user-agents');
|
||||
const { shorten } = require('../../util/Util');
|
||||
|
||||
module.exports = class RottenTomatoesCommand extends Command {
|
||||
@@ -57,7 +58,8 @@ module.exports = class RottenTomatoesCommand extends Command {
|
||||
.query({
|
||||
limit: 10,
|
||||
q: query
|
||||
});
|
||||
})
|
||||
.set({ 'User-Agent': new UserAgent().toString() });
|
||||
if (!body.movies.length) return null;
|
||||
const find = body.movies.find(m => m.name.toLowerCase() === query.toLowerCase()) || body.movies[0];
|
||||
return find.url.replace('/m/', '');
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"tesseract.js": "^2.1.4",
|
||||
"text-diff": "^1.0.1",
|
||||
"tictactoe-minimax-ai": "^1.2.1",
|
||||
"user-agents": "^1.0.594",
|
||||
"valid-url": "^1.0.9",
|
||||
"winston": "^3.3.3",
|
||||
"ytdl-core": "^4.5.0"
|
||||
|
||||
Reference in New Issue
Block a user