diff --git a/README.md b/README.md index 1df744ec..7a34ad1d 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 462 +Total: 463 ### Utility: @@ -442,6 +442,7 @@ Total: 462 * **paladins:** Responds with information on a Paladins player. * **periodic-table:** Finds an element on the periodic table. * **pokedex:** Searches the Pokédex for a Pokémon. +* **pornhub:** Searches Pornhub for your query. (NSFW) * **recipe:** Searches for recipes based on your query. * **reddit:** Responds with information on a Reddit user. * **right-stuf:** Searches Right Stuf Anime for your query. @@ -1274,6 +1275,8 @@ here. * soundboard (Pikachu Sound) * whos-that-pokemon (Images, Original Game) * wynaut (Image, Original Anime) +- [Pornhub](https://www.pornhub.com/) + * pornhub (Video Data) - [Pottermore](https://my.pottermore.com/sorting) * sorting-hat (Original Quiz) - [PSYCHO-PASS](http://psycho-pass.com/) diff --git a/commands/search/pornhub.js b/commands/search/pornhub.js new file mode 100644 index 00000000..15ad5665 --- /dev/null +++ b/commands/search/pornhub.js @@ -0,0 +1,49 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); +const cheerio = require('cheerio'); + +module.exports = class PornhubCommand extends Command { + constructor(client) { + super(client, { + name: 'pornhub', + group: 'search', + memberName: 'pornhub', + description: 'Searches Pornhub for your query.', + nsfw: true, + credit: [ + { + name: 'Pornhub', + url: 'https://www.pornhub.com/', + reason: 'Video Data' + } + ], + args: [ + { + key: 'query', + prompt: 'What video would you like to search for?', + type: 'string' + } + ] + }); + } + + async run(msg, { query }) { + try { + const url = await this.search(query); + if (!url) return msg.say('Could not find any results.'); + return msg.say(url); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } + + async search(query) { + const { text } = await request + .get(`https://www.pornhub.com/video/search`) + .query({ search: query }); + if (text.includes('