├── .gitattributes ├── .gitignore ├── README.md ├── configs.json ├── main.py └── requirements.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # celery beat schedule file 95 | celerybeat-schedule 96 | 97 | # SageMath parsed files 98 | *.sage.py 99 | 100 | # Environments 101 | .env 102 | .venv 103 | env/ 104 | venv/ 105 | ENV/ 106 | env.bak/ 107 | venv.bak/ 108 | 109 | # Spyder project settings 110 | .spyderproject 111 | .spyproject 112 | 113 | # Rope project settings 114 | .ropeproject 115 | 116 | # mkdocs documentation 117 | /site 118 | 119 | # mypy 120 | .mypy_cache/ 121 | .dmypy.json 122 | dmypy.json 123 | 124 | # Pyre type checker 125 | .pyre/ 126 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord NSFW Bot 2 | One of my friends wanted to have a nsfw bot on his discord server but a lot of them are limited if you are not pay for it so i simply made one.
3 | Also it has an mp4 to gif converter. 4 | 5 | # Installation 6 | ``` 7 | pip3 install -r requirements.txt 8 | ``` 9 | 10 | # Usage 11 | First you have to create an app at the discord developer portal then you have to create a bot and paste it's token in the configs.json file.
12 | Add a prefix for the commands for example: $.
13 | If you want to use nudefrom command you have to register an app on reddit then replace the reddit_app_client_id with your app's client_id.
14 | And replace reddit_praw_useragent with your app's description eg: discord random reddit post.
15 | After that you can set your bot's status to be public or not.
16 | Finally, at the oauth section you have to tick something for example bot, then visit the generated website to add the bot to your server. 17 | 18 | # Commands 19 | nudefrom (subredditname) -> Get's a random nsfw picture/gif from the given subreddit
20 | sxyprn_get (sortbynamecategoryname) -> Get's the latest video (sortbynames latest/views/rating/orgasmic) categorynames (all/top/other)
21 | sxyprn_get_random (sortbynamecategoryname) -> Get's a random video (sortbynames latest/views/rating/orgasmic) categorynames (all/top/other)
22 | sxyprn_get_random_latest -> Get's random latest video from the site
23 | sxyprn_get_latest -> Get's the latest video from the site
24 | sxyprn_get_random_most_viewed -> Get's a random most viewed video from the site
25 | sxyprn_get_most_viewed -> Get's the most viewed video from the site
26 | sxyprn_get_random_most_rated -> Get's a random most rated video from the site
27 | sxyprn_get_most_rated -> Get's the top rated video from the site
28 | sxyprn_get_random_most_orgasmic -> Get's a random most 'orgasmic' video from the site
29 | sxyprn_get_most_orgasmic -> Get's the most 'orgasmic' video from the site
30 | sxyprn_get_actress_random_latest (Actress Name) -> Sends you the a random video from the actress please use full names eg -> Aaron Stone
31 | sxyprn_get_actress_latest (Actress Name) -> Sends you the latest video from the actress please use full names eg -> Aaron Stone
32 | xhamster_random -> Sends you a random video
33 | xhamster_get_actress_latest_video (actress name) -> Get's the given actress latest video
34 | xhamster_get_channel_latest_video (channelname) -> Get's the given channel's latest video
35 | xhamster_get_category_latest_video (category) -> Get's the given category's latest video
36 | xhamster_random_daily -> Sends a random daily video
37 | xhamster_best_daily -> Get's the best daily video
38 | xhamster_best_daily_max_duration (maxduration) -> Get's the best daily video with max duration limit
39 | xhamster_best_daily_between_duration (mindurationmaxduration) -> Get's the best daily video with between durations
40 | xhamster_best_daily_min_duration (minduration) -> Get's the best daily video with atleast minimum duration
41 | xhamster_random_weekly -> Sends a random weekly video
42 | xhamster_best_weekly -> Get's the weekly daily video
43 | xhamster_best_weekly_max_duration (maxduration) -> Get's the best weekly video with max duration limit
44 | xhamster_best_weekly_between_duration (mindurationmaxduration) -> Get's the best weekly video with between durations
45 | xhamster_best_weekly_min_duration (minduration) -> Get's the best weekly video with atleast minimum duration
46 | xhamster_random_monthly -> Sends a random monthly video
47 | xhamster_best_monthly -> Get's the best monthly video
48 | xhamster_best_monthly_max_duration (maxduration) -> Get's the best monthly video with max duration limit
49 | xhamster_best_monthly_between_duration (mindurationmaxduration) -> Get's the best monthly video with between durations
50 | xhamster_best_monthly_min_duration (minduration) -> Get's the best monthly video with atleast minimum duration
51 | xhamster_random_year (year) -> Sends a random video from the given year
52 | xhamster_best_year (year) -> Get's the best video in the given year
53 | xhamster_best_year_max_duration (yearmaxduration) -> Get's the best video in the given year with max duration limit
54 | xhamster_best_year_between_duration (yearmindurationmaxduration) -> Get's the best video in the given year with between durations
55 | xhamster_best_year_min_duration (yearminduration) -> Get's the best video in the given year with atleast minimum duration
56 | beeg_latest -> Get's the latest video from the website beeg
57 | beeg_latest_detailed -> Get's the latest video from the website beeg and the actor/acctress name and his/her current videos on the site
58 | mp4togif (url) -> Convert's mp4 file from url to gif and sends it embed
59 | 60 | # Legal 61 | This was merely a speedrun to demonstrate how discord bot's work.
62 | The software designed to perform website security testing.
63 | The author is not responsible for any illegal use of these programs.
64 | I am not accountable for anything you get into.
65 | I am not accountable for any of your actions.
66 | This is 100% educational, please do not misuse this tool.
67 | I don't know if this bot is against discord's ToS or something so use it on your own risk. 68 | -------------------------------------------------------------------------------- /configs.json: -------------------------------------------------------------------------------- 1 | { 2 | "token":"bottokenhere", 3 | "prefix":"botprefixhere", 4 | "author_dc":"onemanbuilds#2108", 5 | "author_dc_server":"https://discord.gg/33UzcuY", 6 | "embed_footer_message":"MADE BY ONEMANBUILDS", 7 | "icon_url":"https://media.discordapp.net/attachments/761523809819820036/762280255770853396/github_onemanbuilds.png", 8 | "reddit_app_client_id":"redditappclientidhere", 9 | "reddit_praw_useragent":"redditprawappuseragenthere" 10 | } -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | import discord 4 | import praw 5 | import random 6 | import asyncio 7 | from bs4 import BeautifulSoup 8 | from discord_webhook import DiscordWebhook 9 | from discord import Webhook,RequestsWebhookAdapter 10 | from discord.ext import commands 11 | 12 | 13 | class Main: 14 | def __init__(self): 15 | with open('configs.json','r') as f: 16 | config = json.load(f) 17 | 18 | self.token = config['token'] 19 | self.prefix = config['prefix'] 20 | self.author_dc = config['author_dc'] 21 | self.author_dc_server = config['author_dc_server'] 22 | self.icon_url = config['icon_url'] 23 | self.embed_colour = 10181046 24 | self.embed_footer_message = config['embed_footer_message'] 25 | self.reddit_app_client_id = config['reddit_app_client_id'] 26 | self.reddit_praw_useragent = config['reddit_praw_useragent'] 27 | self.chrome_header = headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'} 28 | 29 | self.commands = { 30 | "{0}nudefrom (subredditname)".format(self.prefix):"Get's a random nsfw picture/gif from the given subreddit", 31 | "{0}sxyprn_get (sortbyname,categoryname)".format(self.prefix):"Get's the latest video (sortbynames latest/views/rating/orgasmic) categorynames (all/top/other)", 32 | "{0}sxyprn_get_random (sortbyname,categoryname)".format(self.prefix):"Get's a random video (sortbynames latest/views/rating/orgasmic) categorynames (all/top/other)", 33 | "{0}sxyprn_get_random_latest".format(self.prefix):"Get's random latest video from the site", 34 | "{0}sxyprn_get_latest".format(self.prefix):"Get's the latest video from the site", 35 | "{0}sxyprn_get_random_most_viewed".format(self.prefix):"Get's a random most viewed video from the site", 36 | "{0}sxyprn_get_most_viewed".format(self.prefix):"Get's the most viewed video from the site", 37 | "{0}sxyprn_get_random_most_rated".format(self.prefix):"Get's a random most rated video from the site", 38 | "{0}sxyprn_get_most_rated".format(self.prefix):"Get's the top rated video from the site", 39 | "{0}sxyprn_get_random_most_orgasmic".format(self.prefix):"Get's a random most 'orgasmic' video from the site", 40 | "{0}sxyprn_get_most_orgasmic".format(self.prefix):"Get's the most 'orgasmic' video from the site", 41 | "{0}sxyprn_get_actress_random_latest (Actress Name)".format(self.prefix):"Sends you the a random video from the actress please use full names eg: Aaron Stone", 42 | "{0}sxyprn_get_actress_latest (Actress Name)".format(self.prefix):"Sends you the latest video from the actress please use full names eg: Aaron Stone", 43 | "{0}xhamster_random".format(self.prefix):"Sends you a random video", 44 | "{0}xhamster_get_actress_latest_video (actress name)".format(self.prefix):"Get's the given actress latest video", 45 | "{0}xhamster_get_channel_latest_video (channelname)".format(self.prefix):"Get's the given channel's latest video", 46 | "{0}xhamster_get_category_latest_video (category)".format(self.prefix):"Get's the given category's latest video", 47 | "{0}xhamster_random_daily".format(self.prefix):"Sends a random daily video", 48 | "{0}xhamster_best_daily".format(self.prefix):"Get's the best daily video", 49 | "{0}xhamster_best_daily_max_duration (maxduration)".format(self.prefix):"Get's the best daily video with max duration limit", 50 | "{0}xhamster_best_daily_between_duration (minduration,maxduration)".format(self.prefix):"Get's the best daily video with between durations", 51 | "{0}xhamster_best_daily_min_duration (minduration)".format(self.prefix):"Get's the best daily video with atleast minimum duration", 52 | "{0}xhamster_random_weekly".format(self.prefix):"Sends a random weekly video", 53 | "{0}xhamster_best_weekly".format(self.prefix):"Get's the weekly daily video", 54 | "{0}xhamster_best_weekly_max_duration (maxduration)".format(self.prefix):"Get's the best weekly video with max duration limit", 55 | "{0}xhamster_best_weekly_between_duration (minduration,maxduration)".format(self.prefix):"Get's the best weekly video with between durations", 56 | "{0}xhamster_best_weekly_min_duration (minduration)".format(self.prefix):"Get's the best weekly video with atleast minimum duration", 57 | "{0}xhamster_random_monthly".format(self.prefix):"Sends a random monthly video", 58 | "{0}xhamster_best_monthly".format(self.prefix):"Get's the best monthly video", 59 | "{0}xhamster_best_monthly_max_duration (maxduration)".format(self.prefix):"Get's the best monthly video with max duration limit", 60 | "{0}xhamster_best_monthly_between_duration (minduration,maxduration)".format(self.prefix):"Get's the best monthly video with between durations", 61 | "{0}xhamster_best_monthly_min_duration (minduration)".format(self.prefix):"Get's the best monthly video with atleast minimum duration", 62 | "{0}xhamster_random_year (year)".format(self.prefix):"Sends a random video from the given year", 63 | "{0}xhamster_best_year (year)".format(self.prefix):"Get's the best video in the given year", 64 | "{0}xhamster_best_year_max_duration (year,maxduration)".format(self.prefix):"Get's the best video in the given year with max duration limit", 65 | "{0}xhamster_best_year_between_duration (year,minduration,maxduration)".format(self.prefix):"Get's the best video in the given year with between durations", 66 | "{0}xhamster_best_year_min_duration (year,minduration)".format(self.prefix):"Get's the best video in the given year with atleast minimum duration", 67 | "{0}beeg_latest".format(self.prefix):"Get's the latest video from the website beeg", 68 | "{0}beeg_latest_detailed".format(self.prefix):"Get's the latest video from the website beeg and the actor/acctress name and his/her current videos on the site", 69 | "{0}mp4togif (url)".format(self.prefix):"Convert's mp4 file from url to gif and sends it embed" 70 | } 71 | 72 | self.checkWords = ['i.imgur.com', 'gif',"redgif",'webm','jpg','jpeg','png'] 73 | 74 | self.reddit = praw.Reddit(client_id=self.reddit_app_client_id,client_secret=None,user_agent=self.reddit_praw_useragent) 75 | self.bot = commands.Bot(command_prefix=self.prefix, self_bot=False) 76 | 77 | 78 | 79 | def Start(self): 80 | 81 | def mp4togif_from_url(url): 82 | try: 83 | payload = { 84 | 'new-image':'(binary)', 85 | 'new-image-url':url, 86 | 'upload':'Upload video!' 87 | } 88 | response = requests.post('https://s2.ezgif.com/video-to-gif',data=payload) 89 | generated_ezgif_link = response.url 90 | generated_ezgif_filename = generated_ezgif_link.split('/')[-1] 91 | 92 | get_token_response = requests.get(generated_ezgif_link).text 93 | soup = BeautifulSoup(get_token_response,'html.parser') 94 | 95 | token = soup.find('input',{'name':'token'}) 96 | token = token['value'] 97 | 98 | 99 | payload = { 100 | 'file':generated_ezgif_filename, 101 | 'token':token, 102 | 'start':'0', 103 | 'end':'7', 104 | 'size':'original', 105 | 'fps':'10', 106 | 'method':'ffmpeg' 107 | } 108 | 109 | convert_response = requests.post('https://s2.ezgif.com/video-to-gif/{0}?ajax=true'.format(generated_ezgif_filename),data=payload).text 110 | 111 | soup = BeautifulSoup(convert_response,'html.parser') 112 | gif = soup.find('a',{'m-btn-crop'}) 113 | gif_link = gif['href'] 114 | 115 | payload = { 116 | 'file':generated_ezgif_filename, 117 | 'token':token, 118 | 'x1':'0', 119 | 'y1':'0', 120 | 'x2':'original', 121 | 'y2':'original', 122 | 'w':'original', 123 | 'h':'original', 124 | 'method':'gifsicle' 125 | } 126 | 127 | convert_crop = requests.post('{0}?ajax=true'.format(gif_link)).text 128 | 129 | soup = BeautifulSoup(convert_crop,'html.parser') 130 | gif_valid_url = soup.find('a',{'save'})['href'] 131 | #gif_valid_url = gif_valid_url['href'].replace('save','tmp') 132 | 133 | return gif_valid_url 134 | except: 135 | pass 136 | 137 | def get_subreddit(subreddit_name:str): 138 | sub = self.reddit.subreddit(subreddit_name) 139 | posts = [post for post in sub.hot(limit=300)] 140 | random_post_number = random.randint(0, 300) 141 | random_post = posts[random_post_number] 142 | return random_post 143 | 144 | def GetRedGifFullUrl(url): 145 | if 'redgifs.com' in url: 146 | response = requests.get(url,headers=self.chrome_header) 147 | soup = BeautifulSoup(response.content, 'html.parser') 148 | 149 | return soup.find('img').attrs['src'] 150 | else: 151 | return url 152 | 153 | @self.bot.command(pass_context=True) 154 | async def info(ctx): 155 | await ctx.message.delete() 156 | try: 157 | embed_message = discord.Embed(description='**[COMMANDS]**') 158 | embed_message.add_field(name="Author's contact", value="[Discord Server]({0})".format(self.author_dc_server),inline=False) 159 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 160 | embed_message.add_field(name="IMPORTANT",value="Use the commands in a NSFW text channel",inline=False) 161 | for key in self.commands: 162 | embed_message.add_field(name=key,value=self.commands[key],inline=False) 163 | 164 | embed_message.set_footer(text='{0}'.format(self.embed_footer_message)) 165 | embed_message.colour = self.embed_colour 166 | await ctx.send(embed=embed_message) 167 | except: 168 | pass 169 | 170 | @self.bot.command(pass_context=True) 171 | async def nudefrom(ctx,subreddit_name): 172 | await ctx.message.delete() 173 | 174 | sub = get_subreddit(subreddit_name) 175 | url_text = sub.url 176 | has_domain = any(string in url_text for string in self.checkWords) 177 | 178 | while not has_domain: 179 | sub = get_subreddit(subreddit_name) 180 | url_text = sub.url 181 | await asyncio.sleep(0.1) 182 | 183 | if sub.over_18: 184 | if ctx.channel.is_nsfw(): 185 | try: 186 | image_full_url = GetRedGifFullUrl(url_text) 187 | embed_message = discord.Embed(description='**[{0}]**'.format(sub.title)) 188 | embed_message.add_field(name="Author's contact", value="[Discord Server]({0})".format(self.author_dc),inline=False) 189 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 190 | embed_message.set_image(url=image_full_url) 191 | embed_message.set_footer(text='REQUESTED: {0}\n\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 192 | embed_message.colour = self.embed_colour 193 | await ctx.send(embed=embed_message) 194 | except: 195 | pass 196 | 197 | 198 | @self.bot.command(pass_context=True) #categorynames all/top/other #sortbynames latest/views/rating/orgasmic 199 | async def sxyprn_get(ctx,sortbyname,categoryname): 200 | await ctx.message.delete() 201 | if ctx.channel.is_nsfw(): 202 | try: 203 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm={0}&fl={1}".format(sortbyname,categoryname),headers=self.chrome_header).text 204 | soup = BeautifulSoup(response,"html.parser") 205 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 206 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 207 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 208 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[0]['data-title'])) 209 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 210 | embed_message.add_field(name="URL", value=mydivs[0]['data-url'],inline=False) 211 | 212 | vid_url = myimages[0]['src'].split('//',1)[1] 213 | vid_url = "https://{0}".format(vid_url) 214 | #print(myvideos) 215 | if len(myvideos) > 0: 216 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 217 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 218 | vid_url = mp4togif_from_url(valid_mp4_url) 219 | 220 | embed_message.set_image(url=vid_url) 221 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 222 | embed_message.colour = self.embed_colour 223 | await ctx.send(embed=embed_message) 224 | except: 225 | pass 226 | 227 | 228 | @self.bot.command(pass_context=True) #categorynames all/top/other #sortbynames latest/views/rating/orgasmic 229 | async def sxyprn_get_random(ctx,sortbyname,categoryname): 230 | await ctx.message.delete() 231 | if ctx.channel.is_nsfw(): 232 | try: 233 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm={0}&fl={1}".format(sortbyname,categoryname),headers=self.chrome_header).text 234 | soup = BeautifulSoup(response,"html.parser") 235 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 236 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 237 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 238 | random_index = random.randint(0,30) 239 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[random_index]['data-title'])) 240 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 241 | embed_message.add_field(name="URL", value=mydivs[random_index]['data-url'],inline=False) 242 | 243 | vid_url = myimages[random_index]['src'].split('//',1)[1] 244 | vid_url = "https://{0}".format(vid_url) 245 | if len(myvideos) > 0: 246 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 247 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 248 | vid_url = mp4togif_from_url(valid_mp4_url) 249 | 250 | embed_message.set_image(url=vid_url) 251 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 252 | embed_message.colour = self.embed_colour 253 | await ctx.send(embed=embed_message) 254 | except: 255 | pass 256 | 257 | @self.bot.command(pass_context=True) 258 | async def sxyprn_get_latest(ctx): 259 | await ctx.message.delete() 260 | if ctx.channel.is_nsfw(): 261 | try: 262 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=latest&fl=all",headers=self.chrome_header).text 263 | soup = BeautifulSoup(response,"html.parser") 264 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 265 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 266 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 267 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[0]['data-title'])) 268 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 269 | embed_message.add_field(name="URL", value=mydivs[0]['data-url'],inline=False) 270 | vid_url = myimages[0]['src'].split('//',1)[1] 271 | vid_url = "https://{0}".format(vid_url) 272 | 273 | if len(myvideos) > 0: 274 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 275 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 276 | vid_url = mp4togif_from_url(valid_mp4_url) 277 | 278 | embed_message.set_image(url=vid_url) 279 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 280 | embed_message.colour = self.embed_colour 281 | await ctx.send(embed=embed_message) 282 | except: 283 | pass 284 | 285 | 286 | @self.bot.command(pass_context=True) 287 | async def sxyprn_get_random_latest(ctx): 288 | await ctx.message.delete() 289 | if ctx.channel.is_nsfw(): 290 | try: 291 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=latest&fl=all",headers=self.chrome_header).text 292 | soup = BeautifulSoup(response,"html.parser") 293 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 294 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 295 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 296 | random_index = random.randint(0,30) 297 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[random_indexm]['data-title'])) 298 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 299 | embed_message.add_field(name="URL", value=mydivs[random_index]['data-url'],inline=False) 300 | vid_url = myimages[random_index]['src'].split('//',1)[1] 301 | vid_url = "https://{0}".format(vid_url) 302 | 303 | if len(myvideos) > 0: 304 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 305 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 306 | vid_url = mp4togif_from_url(valid_mp4_url) 307 | 308 | embed_message.set_image(url=vid_url) 309 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 310 | embed_message.colour = self.embed_colour 311 | await ctx.send(embed=embed_message) 312 | except: 313 | pass 314 | 315 | @self.bot.command(pass_context=True) 316 | async def sxyprn_get_most_viewed(ctx): 317 | await ctx.message.delete() 318 | if ctx.channel.is_nsfw(): 319 | try: 320 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=views&fl=all",headers=self.chrome_header).text 321 | soup = BeautifulSoup(response,"html.parser") 322 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 323 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 324 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 325 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[0]['data-title'])) 326 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 327 | embed_message.add_field(name="URL", value=mydivs[0]['data-url'],inline=False) 328 | vid_url = myimages[0]['src'].split('//',1)[1] 329 | vid_url = "https://{0}".format(vid_url) 330 | 331 | if len(myvideos) > 0: 332 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 333 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 334 | vid_url = mp4togif_from_url(valid_mp4_url) 335 | 336 | embed_message.set_image(url=vid_url) 337 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 338 | embed_message.colour = self.embed_colour 339 | await ctx.send(embed=embed_message) 340 | except: 341 | pass 342 | 343 | @self.bot.command(pass_context=True) 344 | async def sxyprn_get_random_most_viewed(ctx): 345 | await ctx.message.delete() 346 | if ctx.channel.is_nsfw(): 347 | try: 348 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=views&fl=all",headers=self.chrome_header).text 349 | soup = BeautifulSoup(response,"html.parser") 350 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 351 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 352 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 353 | random_index = random.randint(0,30) 354 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[random_index]['data-title'])) 355 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 356 | embed_message.add_field(name="URL", value=mydivs[random_index]['data-url'],inline=False) 357 | vid_url = myimages[random_index]['src'].split('//',1)[1] 358 | vid_url = "https://{0}".format(vid_url) 359 | 360 | if len(myvideos) > 0: 361 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 362 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 363 | vid_url = mp4togif_from_url(valid_mp4_url) 364 | 365 | embed_message.set_image(url=vid_url) 366 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 367 | embed_message.colour = self.embed_colour 368 | await ctx.send(embed=embed_message) 369 | except: 370 | pass 371 | 372 | @self.bot.command(pass_context=True) 373 | async def sxyprn_get_most_rated(ctx): 374 | await ctx.message.delete() 375 | if ctx.channel.is_nsfw(): 376 | try: 377 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=rating&fl=all",headers=self.chrome_header).text 378 | soup = BeautifulSoup(response,"html.parser") 379 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 380 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 381 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 382 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[0]['data-title'])) 383 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 384 | embed_message.add_field(name="URL", value=mydivs[0]['data-url'],inline=False) 385 | vid_url = myimages[0]['src'].split('//',1)[1] 386 | vid_url = "https://{0}".format(vid_url) 387 | 388 | if len(myvideos) > 0: 389 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 390 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 391 | vid_url = mp4togif_from_url(valid_mp4_url) 392 | 393 | embed_message.set_image(url=vid_url) 394 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 395 | embed_message.colour = self.embed_colour 396 | await ctx.send(embed=embed_message) 397 | except: 398 | pass 399 | 400 | @self.bot.command(pass_context=True) 401 | async def sxyprn_get_random_most_rated(ctx): 402 | await ctx.message.delete() 403 | if ctx.channel.is_nsfw(): 404 | try: 405 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=rating&fl=all",headers=self.chrome_header).text 406 | soup = BeautifulSoup(response,"html.parser") 407 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 408 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 409 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 410 | random_index = random.randint(0,30) 411 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[random_index]['data-title'])) 412 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 413 | embed_message.add_field(name="URL", value=mydivs[random_index]['data-url'],inline=False) 414 | vid_url = myimages[random_index]['src'].split('//',1)[1] 415 | vid_url = "https://{0}".format(vid_url) 416 | 417 | if len(myvideos) > 0: 418 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 419 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 420 | vid_url = mp4togif_from_url(valid_mp4_url) 421 | 422 | embed_message.set_image(url=vid_url) 423 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 424 | embed_message.colour = self.embed_colour 425 | await ctx.send(embed=embed_message) 426 | except: 427 | pass 428 | 429 | 430 | @self.bot.command(pass_context=True) 431 | async def sxyprn_get_most_orgasmic(ctx): 432 | await ctx.message.delete() 433 | if ctx.channel.is_nsfw(): 434 | try: 435 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=orgasmic&fl=all",headers=self.chrome_header).text 436 | soup = BeautifulSoup(response,"html.parser") 437 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 438 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 439 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 440 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[0]['data-title'])) 441 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 442 | embed_message.add_field(name="URL", value=mydivs[0]['data-url'],inline=False) 443 | vid_url = myimages[0]['src'].split('//',1)[1] 444 | vid_url = "https://{0}".format(vid_url) 445 | 446 | if len(myvideos) > 0: 447 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 448 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 449 | vid_url = mp4togif_from_url(valid_mp4_url) 450 | 451 | embed_message.set_image(url=vid_url) 452 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 453 | embed_message.colour = self.embed_colour 454 | await ctx.send(embed=embed_message) 455 | except: 456 | pass 457 | 458 | @self.bot.command(pass_context=True) 459 | async def sxyprn_get_random_most_orgasmic(ctx): 460 | await ctx.message.delete() 461 | if ctx.channel.is_nsfw(): 462 | try: 463 | response = requests.get("https://sxyprn.com/blog/all/0.html?sm=orgasmic&fl=all",headers=self.chrome_header).text 464 | soup = BeautifulSoup(response,"html.parser") 465 | mydivs = soup.findAll("div", {"class": "sharing_toolbox"}) 466 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 467 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 468 | random_index = random.randint(0,30) 469 | embed_message = discord.Embed(description='**[{0}]**'.format(mydivs[random_index]['data-title'])) 470 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 471 | embed_message.add_field(name="URL", value=mydivs[random_index]['data-url'],inline=False) 472 | vid_url = myimages[random_index]['src'].split('//',1)[1] 473 | vid_url = "https://{0}".format(vid_url) 474 | 475 | if len(myvideos) > 0: 476 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 477 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 478 | vid_url = mp4togif_from_url(valid_mp4_url) 479 | 480 | embed_message.set_image(url=vid_url) 481 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 482 | embed_message.colour = self.embed_colour 483 | await ctx.send(embed=embed_message) 484 | except: 485 | pass 486 | 487 | 488 | @self.bot.command(pass_context=True) 489 | async def sxyprn_get_actress_latest(ctx,actressname): 490 | await ctx.message.delete() 491 | if ctx.channel.is_nsfw(): 492 | try: 493 | response = requests.get("https://sxyprn.com/{0}.html".format(actressname.replace(' ','-')),headers=self.chrome_header).text 494 | 495 | soup = BeautifulSoup(response,"html.parser") 496 | video_datas = soup.findAll("a", {"class": "tdn post_time"}) 497 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 498 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 499 | embed_message = discord.Embed(description='**[{0}]**'.format(video_datas[0]['title'])) 500 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 501 | embed_message.add_field(name="URL", value='https://sxyprn.com{0}'.format(video_datas[0]['href']),inline=False) 502 | vid_url = myimages[0]['src'].split('//',1)[1] 503 | vid_url = "https://{0}".format(vid_url) 504 | 505 | if len(myvideos) > 0: 506 | valid_mp4_url = myvideos[0]['src'].split('//',1)[1] 507 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 508 | vid_url = mp4togif_from_url(valid_mp4_url) 509 | 510 | embed_message.set_image(url=vid_url) 511 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 512 | embed_message.colour = self.embed_colour 513 | await ctx.send(embed=embed_message) 514 | except: 515 | pass 516 | 517 | @self.bot.command(pass_context=True) 518 | async def sxyprn_get_actress_random_latest(ctx,actressname): 519 | await ctx.message.delete() 520 | if ctx.channel.is_nsfw(): 521 | try: 522 | response = requests.get("https://sxyprn.com/{0}.html".format(actressname.replace(' ','-')),headers=self.chrome_header).text 523 | 524 | soup = BeautifulSoup(response,"html.parser") 525 | video_datas = soup.findAll("a", {"class": "tdn post_time"}) 526 | myimages = soup.findAll("img",{"class": "mini_post_vid_thumb"}) 527 | myvideos = soup.findAll("video",{"class": "hvp_player"}) 528 | random_index = random.randint(0,30) 529 | embed_message = discord.Embed(description='**[{0}]**'.format(video_datas[random_index]['title'])) 530 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 531 | embed_message.add_field(name="URL", value='https://sxyprn.com{0}'.format(video_datas[random_index]['href']),inline=False) 532 | vid_url = myimages[random_index]['src'].split('//',1)[1] 533 | vid_url = "https://{0}".format(vid_url) 534 | 535 | if len(myvideos) > 0: 536 | valid_mp4_url = myvideos[random_index]['src'].split('//',1)[1] 537 | valid_mp4_url = "https://{0}".format(valid_mp4_url) 538 | vid_url = mp4togif_from_url(valid_mp4_url) 539 | 540 | embed_message.set_image(url=vid_url) 541 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 542 | embed_message.colour = self.embed_colour 543 | await ctx.send(embed=embed_message) 544 | except : 545 | pass 546 | 547 | 548 | 549 | @self.bot.command(pass_context=True) 550 | async def xhamster_random(ctx): 551 | await ctx.message.delete() 552 | try: 553 | if ctx.channel.is_nsfw(): 554 | response = requests.get('https://xhamster.com/',headers=self.chrome_header).text 555 | soup = BeautifulSoup(response,'html.parser') 556 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 557 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 558 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 559 | random_vid_index = random.randint(0,30) 560 | video_link = ref_links[random_vid_index]['href'] 561 | video_mp4 = ref_links[random_vid_index]['data-previewvideo'] 562 | gif_url = mp4togif_from_url(video_mp4) 563 | video_title = preview_data[random_vid_index]['alt'] 564 | video_duration = durations[random_vid_index].getText() 565 | 566 | embed_message = discord.Embed(description='**[{0} VIDEO]**\n'.format(video_title)) 567 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 568 | embed_message.add_field(name="URL", value=video_link,inline=False) 569 | embed_message.set_image(url=gif_url) 570 | embed_message.add_field(name='DURATION',value=video_duration,inline=False) 571 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 572 | embed_message.colour = self.embed_colour 573 | await ctx.send(embed=embed_message) 574 | except: 575 | pass 576 | 577 | @self.bot.command(pass_context=True) 578 | async def xhamster_get_actress_latest_video(ctx,actressname): 579 | await ctx.message.delete() 580 | try: 581 | if ctx.channel.is_nsfw(): 582 | valid_actress_name = actressname.replace(' ','-') 583 | response = requests.get('https://xhamster.com/pornstars/{0}'.format(valid_actress_name),headers=self.chrome_header).text 584 | soup = BeautifulSoup(response,'html.parser') 585 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 586 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 587 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 588 | top_video_link = ref_links[0]['href'] 589 | top_video_mp4 = ref_links[0]['data-previewvideo'] 590 | gif_url = mp4togif_from_url(top_video_mp4) 591 | top_video_title = preview_data[0]['alt'] 592 | top_video_duration = durations[0].getText() 593 | 594 | embed_message = discord.Embed(description='**[{0} LATEST VIDEO]**\n{1}'.format(actressname,top_video_title)) 595 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 596 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 597 | embed_message.set_image(url=gif_url) 598 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 599 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 600 | embed_message.colour = self.embed_colour 601 | await ctx.send(embed=embed_message) 602 | except: 603 | pass 604 | 605 | @self.bot.command(pass_context=True) 606 | async def xhamster_get_channel_latest_video(ctx,channelname): 607 | await ctx.message.delete() 608 | try: 609 | if ctx.channel.is_nsfw(): 610 | valid_channel_name = channelname.replace(' ','-') 611 | response = requests.get('https://xhamster.com/channels/{0}'.format(valid_channel_name),headers=self.chrome_header).text 612 | soup = BeautifulSoup(response,'html.parser') 613 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 614 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 615 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 616 | top_video_link = ref_links[0]['href'] 617 | top_video_link = ref_links[0]['href'] 618 | top_video_mp4 = ref_links[0]['data-previewvideo'] 619 | gif_url = mp4togif_from_url(top_video_mp4) 620 | top_video_title = preview_data[0]['alt'] 621 | top_video_duration = durations[0].getText() 622 | 623 | embed_message = discord.Embed(description='**[{0} LATEST VIDEO]**\n{1}'.format(valid_channel_name,top_video_title)) 624 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 625 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 626 | embed_message.set_image(url=gif_url) 627 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 628 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 629 | embed_message.colour = self.embed_colour 630 | await ctx.send(embed=embed_message) 631 | except: 632 | pass 633 | 634 | @self.bot.command(pass_context=True) 635 | async def xhamster_get_category_latest_video(ctx,categoryname): 636 | await ctx.message.delete() 637 | try: 638 | if ctx.channel.is_nsfw(): 639 | response = requests.get('https://xhamster.com/categories/{0}'.format(categoryname),headers=self.chrome_header).text 640 | soup = BeautifulSoup(response,'html.parser') 641 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 642 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 643 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 644 | top_video_link = ref_links[0]['href'] 645 | top_video_mp4 = ref_links[0]['data-previewvideo'] 646 | gif_url = mp4togif_from_url(top_video_mp4) 647 | top_video_title = preview_data[0]['alt'] 648 | top_video_duration = durations[0].getText() 649 | 650 | embed_message = discord.Embed(description='**[{0} LATEST VIDEO]**\n{1}'.format(categoryname,top_video_title)) 651 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 652 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 653 | embed_message.set_image(url=gif_url) 654 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 655 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 656 | embed_message.colour = self.embed_colour 657 | await ctx.send(embed=embed_message) 658 | except: 659 | pass 660 | 661 | @self.bot.command(pass_context=True) 662 | async def xhamster_best_daily(ctx): 663 | await ctx.message.delete() 664 | try: 665 | if ctx.channel.is_nsfw(): 666 | response = requests.get('https://xhamster.com/best/daily',headers=self.chrome_header).text 667 | soup = BeautifulSoup(response,'html.parser') 668 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 669 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 670 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 671 | top_video_link = ref_links[0]['href'] 672 | top_video_mp4 = ref_links[0]['data-previewvideo'] 673 | gif_url = mp4togif_from_url(top_video_mp4) 674 | top_video_title = preview_data[0]['alt'] 675 | top_video_duration = durations[0].getText() 676 | 677 | embed_message = discord.Embed(description='**[BEST DAILY VIDEO]**\n{0}'.format(top_video_title)) 678 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 679 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 680 | embed_message.set_image(url=gif_url) 681 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 682 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 683 | embed_message.colour = self.embed_colour 684 | await ctx.send(embed=embed_message) 685 | except: 686 | pass 687 | 688 | @self.bot.command(pass_context=True) 689 | async def xhamster_random_daily(ctx): 690 | await ctx.message.delete() 691 | try: 692 | if ctx.channel.is_nsfw(): 693 | response = requests.get('https://xhamster.com/best/daily',headers=self.chrome_header).text 694 | soup = BeautifulSoup(response,'html.parser') 695 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 696 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 697 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 698 | random_vid_index = random.randint(0,30) 699 | top_video_link = ref_links[random_vid_index]['href'] 700 | top_video_mp4 = ref_links[random_vid_index]['data-previewvideo'] 701 | gif_url = mp4togif_from_url(top_video_mp4) 702 | top_video_title = preview_data[random_vid_index]['alt'] 703 | top_video_duration = durations[random_vid_index].getText() 704 | 705 | embed_message = discord.Embed(description='**[RANDOM DAILY VIDEO]**\n{0}'.format(top_video_title)) 706 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 707 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 708 | embed_message.set_image(url=gif_url) 709 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 710 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 711 | embed_message.colour = self.embed_colour 712 | await ctx.send(embed=embed_message) 713 | except: 714 | await xhamster_best_daily(ctx) 715 | 716 | @self.bot.command(pass_context=True) 717 | async def xhamster_best_daily_max_duration(ctx,max_duration): 718 | await ctx.message.delete() 719 | try: 720 | if ctx.channel.is_nsfw(): 721 | response = requests.get('https://xhamster.com/best/daily?max-duration={0}'.format(max_duration),headers=self.chrome_header).text 722 | soup = BeautifulSoup(response,'html.parser') 723 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 724 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 725 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 726 | top_video_link = ref_links[0]['href'] 727 | top_video_mp4 = ref_links[0]['data-previewvideo'] 728 | gif_url = mp4togif_from_url(top_video_mp4) 729 | top_video_title = preview_data[0]['alt'] 730 | top_video_duration = durations[0].getText() 731 | 732 | embed_message = discord.Embed(description='**[BEST DAILY VIDEO {0}min]**\n{1}'.format(max_duration,top_video_title)) 733 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 734 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 735 | embed_message.set_image(url=gif_url) 736 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 737 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 738 | embed_message.colour = self.embed_colour 739 | await ctx.send(embed=embed_message) 740 | except: 741 | pass 742 | 743 | 744 | @self.bot.command(pass_context=True) 745 | async def xhamster_best_daily_between_duration(ctx,min_duration,max_duration): 746 | await ctx.message.delete() 747 | try: 748 | if ctx.channel.is_nsfw(): 749 | response = requests.get('https://xhamster.com/best/daily?min-duration={0}&max-duration={1}'.format(min_duration,max_duration),headers=self.chrome_header).text 750 | soup = BeautifulSoup(response,'html.parser') 751 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 752 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 753 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 754 | top_video_link = ref_links[0]['href'] 755 | top_video_mp4 = ref_links[0]['data-previewvideo'] 756 | gif_url = mp4togif_from_url(top_video_mp4) 757 | top_video_title = preview_data[0]['alt'] 758 | top_video_duration = durations[0].getText() 759 | 760 | embed_message = discord.Embed(description='**[BEST DAILY VIDEO {0}min-{1}min]**\n{2}'.format(min_duration,max_duration,top_video_title)) 761 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 762 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 763 | embed_message.set_image(url=gif_url) 764 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 765 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 766 | embed_message.colour = self.embed_colour 767 | await ctx.send(embed=embed_message) 768 | except: 769 | pass 770 | 771 | 772 | @self.bot.command(pass_context=True) 773 | async def xhamster_best_daily_min_duration(ctx,min_duration): 774 | await ctx.message.delete() 775 | try: 776 | if ctx.channel.is_nsfw(): 777 | response = requests.get('https://xhamster.com/best/daily?min-duration={0}'.format(min_duration),headers=self.chrome_header).text 778 | soup = BeautifulSoup(response,'html.parser') 779 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 780 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 781 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 782 | top_video_link = ref_links[0]['href'] 783 | top_video_mp4 = ref_links[0]['data-previewvideo'] 784 | gif_url = mp4togif_from_url(top_video_mp4) 785 | top_video_title = preview_data[0]['alt'] 786 | top_video_duration = durations[0].getText() 787 | 788 | embed_message = discord.Embed(description='**[BEST DAILY VIDEO {0}min]**\n{1}'.format(min_duration,top_video_title)) 789 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 790 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 791 | embed_message.set_image(url=gif_url) 792 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 793 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 794 | embed_message.colour = self.embed_colour 795 | await ctx.send(embed=embed_message) 796 | except: 797 | pass 798 | 799 | 800 | @self.bot.command(pass_context=True) 801 | async def xhamster_random_weekly(ctx): 802 | await ctx.message.delete() 803 | try: 804 | if ctx.channel.is_nsfw(): 805 | response = requests.get('https://xhamster.com/best/weekly',headers=self.chrome_header).text 806 | soup = BeautifulSoup(response,'html.parser') 807 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 808 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 809 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 810 | random_vid_index = random.randint(0,30) 811 | top_video_link = ref_links[random_vid_index]['href'] 812 | top_video_mp4 = ref_links[random_vid_index]['data-previewvideo'] 813 | gif_url = mp4togif_from_url(top_video_mp4) 814 | top_video_title = preview_data[random_vid_index]['alt'] 815 | top_video_duration = durations[random_vid_index].getText() 816 | 817 | embed_message = discord.Embed(description='**[RANDOM WEEKLY VIDEO]**\n{0}'.format(top_video_title)) 818 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 819 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 820 | embed_message.set_image(url=gif_url) 821 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 822 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 823 | embed_message.colour = self.embed_colour 824 | await ctx.send(embed=embed_message) 825 | except: 826 | await xhamster_random_weekly(ctx) 827 | 828 | 829 | @self.bot.command(pass_context=True) 830 | async def xhamster_best_weekly(ctx): 831 | await ctx.message.delete() 832 | try: 833 | if ctx.channel.is_nsfw(): 834 | response = requests.get('https://xhamster.com/best/weekly',headers=self.chrome_header).text 835 | soup = BeautifulSoup(response,'html.parser') 836 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 837 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 838 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 839 | top_video_link = ref_links[0]['href'] 840 | top_video_mp4 = ref_links[0]['data-previewvideo'] 841 | gif_url = mp4togif_from_url(top_video_mp4) 842 | top_video_title = preview_data[0]['alt'] 843 | top_video_duration = durations[0].getText() 844 | 845 | embed_message = discord.Embed(description='**[BEST WEEKLY VIDEO]**\n{0}'.format(top_video_title)) 846 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 847 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 848 | embed_message.set_image(url=gif_url) 849 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 850 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 851 | embed_message.colour = self.embed_colour 852 | await ctx.send(embed=embed_message) 853 | 854 | except: 855 | pass 856 | 857 | 858 | @self.bot.command(pass_context=True) 859 | async def xhamster_best_weekly_max_duration(ctx,max_duration): 860 | await ctx.message.delete() 861 | try: 862 | if ctx.channel.is_nsfw(): 863 | response = requests.get('https://xhamster.com/best/weekly?max-duration={0}'.format(max_duration),headers=self.chrome_header).text 864 | soup = BeautifulSoup(response,'html.parser') 865 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 866 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 867 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 868 | top_video_link = ref_links[0]['href'] 869 | top_video_mp4 = ref_links[0]['data-previewvideo'] 870 | gif_url = mp4togif_from_url(top_video_mp4) 871 | top_video_title = preview_data[0]['alt'] 872 | top_video_duration = durations[0].getText() 873 | 874 | embed_message = discord.Embed(description='**[BEST WEEKLY VIDEO {0}min]**\n{1}'.format(max_duration,top_video_title)) 875 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 876 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 877 | embed_message.set_image(url=gif_url) 878 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 879 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 880 | embed_message.colour = self.embed_colour 881 | await ctx.send(embed=embed_message) 882 | except: 883 | pass 884 | 885 | 886 | @self.bot.command(pass_context=True) 887 | async def xhamster_best_weekly_between_duration(ctx,min_duration,max_duration): 888 | await ctx.message.delete() 889 | try: 890 | if ctx.channel.is_nsfw(): 891 | response = requests.get('https://xhamster.com/best/weekly?min-duration={0}&max-duration={1}'.format(min_duration,max_duration),headers=self.chrome_header).text 892 | soup = BeautifulSoup(response,'html.parser') 893 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 894 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 895 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 896 | top_video_link = ref_links[0]['href'] 897 | top_video_mp4 = ref_links[0]['data-previewvideo'] 898 | gif_url = mp4togif_from_url(top_video_mp4) 899 | top_video_title = preview_data[0]['alt'] 900 | top_video_duration = durations[0].getText() 901 | 902 | embed_message = discord.Embed(description='**[BEST WEEKLY VIDEO {0}min-{1}min]**\n{2}'.format(min_duration,max_duration,top_video_title)) 903 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 904 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 905 | embed_message.set_image(url=gif_url) 906 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 907 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 908 | embed_message.colour = self.embed_colour 909 | await ctx.send(embed=embed_message) 910 | except: 911 | pass 912 | 913 | 914 | @self.bot.command(pass_context=True) 915 | async def xhamster_best_weekly_min_duration(ctx,min_duration): 916 | await ctx.message.delete() 917 | try: 918 | if ctx.channel.is_nsfw(): 919 | response = requests.get('https://xhamster.com/best/weekly?min-duration={0}'.format(min_duration),headers=self.chrome_header).text 920 | soup = BeautifulSoup(response,'html.parser') 921 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 922 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 923 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 924 | top_video_link = ref_links[0]['href'] 925 | top_video_mp4 = ref_links[0]['data-previewvideo'] 926 | gif_url = mp4togif_from_url(top_video_mp4) 927 | top_video_title = preview_data[0]['alt'] 928 | top_video_duration = durations[0].getText() 929 | 930 | embed_message = discord.Embed(description='**[BEST WEEKLY VIDEO {0}min]**\n{1}'.format(min_duration,top_video_title)) 931 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 932 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 933 | embed_message.set_image(url=gif_url) 934 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 935 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 936 | embed_message.colour = self.embed_colour 937 | await ctx.send(embed=embed_message) 938 | except: 939 | pass 940 | 941 | 942 | @self.bot.command(pass_context=True) 943 | async def xhamster_random_monthly(ctx): 944 | await ctx.message.delete() 945 | try: 946 | if ctx.channel.is_nsfw(): 947 | response = requests.get('https://xhamster.com/best/monthly',headers=self.chrome_header).text 948 | soup = BeautifulSoup(response,'html.parser') 949 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 950 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 951 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 952 | random_vid_index = random.randint(0,30) 953 | top_video_link = ref_links[random_vid_index]['href'] 954 | top_video_mp4 = ref_links[random_vid_index]['data-previewvideo'] 955 | gif_url = mp4togif_from_url(top_video_mp4) 956 | top_video_title = preview_data[random_vid_index]['alt'] 957 | top_video_duration = durations[random_vid_index].getText() 958 | 959 | embed_message = discord.Embed(description='**[RANDOM MONTHLY VIDEO]**\n{0}'.format(top_video_title)) 960 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 961 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 962 | embed_message.set_image(url=gif_url) 963 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 964 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 965 | embed_message.colour = self.embed_colour 966 | await ctx.send(embed=embed_message) 967 | except: 968 | await xhamster_random_monthly(ctx) 969 | 970 | @self.bot.command(pass_context=True) 971 | async def xhamster_best_monthly(ctx): 972 | await ctx.message.delete() 973 | try: 974 | if ctx.channel.is_nsfw(): 975 | response = requests.get('https://xhamster.com/best/monthly',headers=self.chrome_header).text 976 | soup = BeautifulSoup(response,'html.parser') 977 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 978 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 979 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 980 | top_video_link = ref_links[0]['href'] 981 | top_video_mp4 = ref_links[0]['data-previewvideo'] 982 | gif_url = mp4togif_from_url(top_video_mp4) 983 | top_video_title = preview_data[0]['alt'] 984 | top_video_duration = durations[0].getText() 985 | 986 | embed_message = discord.Embed(description='**[BEST MONTHLY VIDEO]**\n{0}'.format(top_video_title)) 987 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 988 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 989 | embed_message.set_image(url=gif_url) 990 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 991 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 992 | embed_message.colour = self.embed_colour 993 | await ctx.send(embed=embed_message) 994 | except: 995 | pass 996 | 997 | 998 | @self.bot.command(pass_context=True) 999 | async def xhamster_best_monthly_max_duration(ctx,max_duration): 1000 | await ctx.message.delete() 1001 | try: 1002 | if ctx.channel.is_nsfw(): 1003 | response = requests.get('https://xhamster.com/best/monthly?max-duration={0}'.format(max_duration),headers=self.chrome_header).text 1004 | soup = BeautifulSoup(response,'html.parser') 1005 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1006 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1007 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1008 | top_video_link = ref_links[0]['href'] 1009 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1010 | gif_url = mp4togif_from_url(top_video_mp4) 1011 | top_video_title = preview_data[0]['alt'] 1012 | top_video_duration = durations[0].getText() 1013 | 1014 | embed_message = discord.Embed(description='**[BEST MONTHLY VIDEO {0}min]**\n{1}'.format(max_duration,top_video_title)) 1015 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1016 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1017 | embed_message.set_image(url=gif_url) 1018 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1019 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1020 | embed_message.colour = self.embed_colour 1021 | await ctx.send(embed=embed_message) 1022 | except: 1023 | pass 1024 | 1025 | 1026 | @self.bot.command(pass_context=True) 1027 | async def xhamster_best_monthly_between_duration(ctx,min_duration,max_duration): 1028 | await ctx.message.delete() 1029 | try: 1030 | if ctx.channel.is_nsfw(): 1031 | response = requests.get('https://xhamster.com/best/monthly?min-duration={0}&max-duration={1}'.format(min_duration,max_duration),headers=self.chrome_header).text 1032 | soup = BeautifulSoup(response,'html.parser') 1033 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1034 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1035 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1036 | top_video_link = ref_links[0]['href'] 1037 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1038 | gif_url = mp4togif_from_url(top_video_mp4) 1039 | top_video_title = preview_data[0]['alt'] 1040 | top_video_duration = durations[0].getText() 1041 | 1042 | embed_message = discord.Embed(description='**[BEST MONTHLY VIDEO {0}min-{1}min]**\n{2}'.format(min_duration,max_duration,top_video_title)) 1043 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1044 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1045 | embed_message.set_image(url=gif_url) 1046 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1047 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1048 | embed_message.colour = self.embed_colour 1049 | await ctx.send(embed=embed_message) 1050 | except: 1051 | pass 1052 | 1053 | 1054 | @self.bot.command(pass_context=True) 1055 | async def xhamster_best_monthly_min_duration(ctx,min_duration): 1056 | await ctx.message.delete() 1057 | try: 1058 | if ctx.channel.is_nsfw(): 1059 | response = requests.get('https://xhamster.com/best/monthly?min-duration={0}'.format(min_duration),headers=self.chrome_header).text 1060 | soup = BeautifulSoup(response,'html.parser') 1061 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1062 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1063 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1064 | top_video_link = ref_links[0]['href'] 1065 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1066 | gif_url = mp4togif_from_url(top_video_mp4) 1067 | top_video_title = preview_data[0]['alt'] 1068 | top_video_duration = durations[0].getText() 1069 | 1070 | embed_message = discord.Embed(description='**[BEST MONTHLY VIDEO {0}min]**\n{1}'.format(min_duration,top_video_title)) 1071 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1072 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1073 | embed_message.set_image(url=gif_url) 1074 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1075 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1076 | embed_message.colour = self.embed_colour 1077 | await ctx.send(embed=embed_message) 1078 | except: 1079 | pass 1080 | 1081 | @self.bot.command(pass_context=True) 1082 | async def xhamster_random_yearly(ctx,year): 1083 | await ctx.message.delete() 1084 | try: 1085 | if ctx.channel.is_nsfw(): 1086 | response = requests.get('https://xhamster.com/best/year-{0}'.format(year),headers=self.chrome_header).text 1087 | soup = BeautifulSoup(response,'html.parser') 1088 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1089 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1090 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1091 | random_vid_index = random.randint(0,30) 1092 | top_video_link = ref_links[random_vid_index]['href'] 1093 | top_video_mp4 = ref_links[random_vid_index]['data-previewvideo'] 1094 | gif_url = mp4togif_from_url(top_video_mp4) 1095 | top_video_title = preview_data[random_vid_index]['alt'] 1096 | top_video_duration = durations[random_vid_index].getText() 1097 | 1098 | embed_message = discord.Embed(description='**[RANDOM {0} YEAR VIDEO]**\n{1}'.format(year,top_video_title)) 1099 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1100 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1101 | embed_message.set_image(url=gif_url) 1102 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1103 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1104 | embed_message.colour = self.embed_colour 1105 | await ctx.send(embed=embed_message) 1106 | except: 1107 | await xhamster_random_yearly(ctx,year) 1108 | 1109 | 1110 | @self.bot.command(pass_context=True) 1111 | async def xhamster_best_year(ctx,year): 1112 | await ctx.message.delete() 1113 | try: 1114 | if ctx.channel.is_nsfw(): 1115 | response = requests.get('https://xhamster.com/best/year-{0}'.format(year),headers=self.chrome_header).text 1116 | soup = BeautifulSoup(response,'html.parser') 1117 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1118 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1119 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1120 | top_video_link = ref_links[0]['href'] 1121 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1122 | gif_url = mp4togif_from_url(top_video_mp4) 1123 | top_video_title = preview_data[0]['alt'] 1124 | top_video_duration = durations[0].getText() 1125 | 1126 | embed_message = discord.Embed(description='**[BEST {0} YEAR VIDEO]**\n{1}'.format(year,top_video_title)) 1127 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1128 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1129 | embed_message.set_image(url=gif_url) 1130 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1131 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1132 | embed_message.colour = self.embed_colour 1133 | await ctx.send(embed=embed_message) 1134 | except: 1135 | pass 1136 | 1137 | 1138 | @self.bot.command(pass_context=True) 1139 | async def xhamster_best_year_max_duration(ctx,year,max_duration): 1140 | await ctx.message.delete() 1141 | try: 1142 | if ctx.channel.is_nsfw(): 1143 | response = requests.get('https://xhamster.com/best/year-{0}?max-duration={1}'.format(year,max_duration),headers=self.chrome_header).text 1144 | soup = BeautifulSoup(response,'html.parser') 1145 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1146 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1147 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1148 | top_video_link = ref_links[0]['href'] 1149 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1150 | gif_url = mp4togif_from_url(top_video_mp4) 1151 | top_video_title = preview_data[0]['alt'] 1152 | top_video_duration = durations[0].getText() 1153 | 1154 | embed_message = discord.Embed(description='**[BEST {0} YEAR VIDEO {1}min]**\n{2}'.format(year,max_duration,top_video_title)) 1155 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1156 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1157 | embed_message.set_image(url=gif_url) 1158 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1159 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1160 | embed_message.colour = self.embed_colour 1161 | await ctx.send(embed=embed_message) 1162 | except: 1163 | pass 1164 | 1165 | 1166 | @self.bot.command(pass_context=True) 1167 | async def xhamster_best_year_between_duration(ctx,year,min_duration,max_duration): 1168 | await ctx.message.delete() 1169 | try: 1170 | if ctx.channel.is_nsfw(): 1171 | response = requests.get('https://xhamster.com/best/year-{0}?min-duration={1}&max-duration={2}'.format(year,min_duration,max_duration),headers=self.chrome_header).text 1172 | soup = BeautifulSoup(response,'html.parser') 1173 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1174 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1175 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1176 | top_video_link = ref_links[0]['href'] 1177 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1178 | gif_url = mp4togif_from_url(top_video_mp4) 1179 | top_video_title = preview_data[0]['alt'] 1180 | top_video_duration = durations[0].getText() 1181 | 1182 | embed_message = discord.Embed(description='**[BEST {0} YEAR VIDEO {1}min-{2}min]**\n{3}'.format(year,min_duration,max_duration,top_video_title)) 1183 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1184 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1185 | embed_message.set_image(url=gif_url) 1186 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1187 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1188 | embed_message.colour = self.embed_colour 1189 | await ctx.send(embed=embed_message) 1190 | except: 1191 | pass 1192 | 1193 | 1194 | @self.bot.command(pass_context=True) 1195 | async def xhamster_best_year_min_duration(ctx,year,min_duration): 1196 | await ctx.message.delete() 1197 | try: 1198 | if ctx.channel.is_nsfw(): 1199 | response = requests.get('https://xhamster.com/best/year-{0}?min-duration={1}'.format(year,min_duration),headers=self.chrome_header).text 1200 | soup = BeautifulSoup(response,'html.parser') 1201 | ref_links = soup.find_all('a',{'class':'video-thumb__image-container thumb-image-container'}) 1202 | preview_data = soup.find_all('img',{'thumb-image-container__image'}) 1203 | durations = soup.find_all('div',{'thumb-image-container__duration'}) 1204 | top_video_link = ref_links[0]['href'] 1205 | top_video_mp4 = ref_links[0]['data-previewvideo'] 1206 | gif_url = mp4togif_from_url(top_video_mp4) 1207 | top_video_title = preview_data[0]['alt'] 1208 | top_video_duration = durations[0].getText() 1209 | 1210 | embed_message = discord.Embed(description='**[BEST {0} YEAR VIDEO {1}min]**\n{2}'.format(year,min_duration,top_video_title)) 1211 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1212 | embed_message.add_field(name="URL", value=top_video_link,inline=False) 1213 | embed_message.set_image(url=gif_url) 1214 | embed_message.add_field(name='DURATION',value=top_video_duration,inline=False) 1215 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1216 | embed_message.colour = self.embed_colour 1217 | await ctx.send(embed=embed_message) 1218 | except: 1219 | pass 1220 | 1221 | @self.bot.command(pass_context=True) 1222 | async def beeg_latest(ctx): #if this is not working then it is probably ratelimited 1223 | await ctx.message.delete() 1224 | try: 1225 | if ctx.channel.is_nsfw(): 1226 | response = requests.get('https://beeg.com',headers=self.chrome_header).text 1227 | 1228 | soup = BeautifulSoup(response,'html.parser') 1229 | 1230 | video_ref_urls = soup.find_all('a',{'XxxThumb__content'}) 1231 | video_data = soup.find_all('img',{'XxxThumb__img-preview'}) 1232 | 1233 | first_video_title = video_data[0]['alt'] 1234 | first_video_thumbnail = video_data[0]['src'] 1235 | first_video_url = 'https://beeg.com{0}'.format(video_ref_urls[0]['href']) 1236 | 1237 | embed_message = discord.Embed(description='**[BEEG LATEST VIDEO]**\n{0}'.format(first_video_title)) 1238 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1239 | embed_message.add_field(name="URL", value=first_video_url,inline=False) 1240 | embed_message.set_image(url=first_video_thumbnail) 1241 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1242 | embed_message.colour = self.embed_colour 1243 | await ctx.send(embed=embed_message) 1244 | except: 1245 | pass 1246 | 1247 | @self.bot.command(pass_context=True) 1248 | async def beeg_latest_detailed(ctx): #if this is not working then it is probably ratelimited 1249 | await ctx.message.delete() 1250 | try: 1251 | if ctx.channel.is_nsfw(): 1252 | 1253 | response = requests.get('https://beeg.com',headers=self.chrome_header).text 1254 | 1255 | soup = BeautifulSoup(response,'html.parser') 1256 | 1257 | video_ref_urls = soup.find_all('a',{'XxxThumb__content'}) 1258 | video_data = soup.find_all('img',{'XxxThumb__img-preview'}) 1259 | 1260 | first_video_title = video_data[0]['alt'] 1261 | first_video_thumbnail = video_data[0]['src'] 1262 | first_video_url = 'https://beeg.com{0}'.format(video_ref_urls[0]['href']) 1263 | 1264 | response = requests.get(first_video_url,headers=self.chrome_header).text 1265 | 1266 | soup = BeautifulSoup(response,'html.parser') 1267 | 1268 | video_actors = soup.find_all('a',{'XxxChannelListing__title'}) 1269 | first_video_actor = video_actors[0].getText() 1270 | video_actors_videos = soup.find_all('div','XxxChannelListing__videos') 1271 | first_video_actor_videos = video_actors_videos[0].getText() 1272 | 1273 | embed_message = discord.Embed(description='**[BEEG LATEST VIDEO]**\n{0}'.format(first_video_title)) 1274 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1275 | embed_message.add_field(name="URL", value=first_video_url,inline=False) 1276 | embed_message.set_image(url=first_video_thumbnail) 1277 | embed_message.add_field(name="Actor/Actress name", value=first_video_actor,inline=False) 1278 | embed_message.add_field(name="Actor/Actress videos", value=first_video_actor_videos,inline=False) 1279 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1280 | embed_message.colour = self.embed_colour 1281 | await ctx.send(embed=embed_message) 1282 | except: 1283 | pass 1284 | 1285 | 1286 | @self.bot.command(pass_context=True) 1287 | async def mp4togif(ctx,url): 1288 | await ctx.message.delete() 1289 | try: 1290 | payload = { 1291 | 'new-image':'(binary)', 1292 | 'new-image-url':url, 1293 | 'upload':'Upload video!' 1294 | } 1295 | response = requests.post('https://s2.ezgif.com/video-to-gif',data=payload) 1296 | generated_ezgif_link = response.url 1297 | generated_ezgif_filename = generated_ezgif_link.split('/')[-1] 1298 | 1299 | get_token_response = requests.get(generated_ezgif_link).text 1300 | soup = BeautifulSoup(get_token_response,'html.parser') 1301 | 1302 | token = soup.find('input',{'name':'token'}) 1303 | token = token['value'] 1304 | 1305 | payload = { 1306 | 'file':generated_ezgif_filename, 1307 | 'token':token, #if the request is wrong then they changed the method 1308 | 'start':'0', 1309 | 'end':'7', 1310 | 'size':'original', 1311 | 'fps':'10', 1312 | 'method':'ffmpeg' 1313 | } 1314 | 1315 | convert_response = requests.post('https://s2.ezgif.com/video-to-gif/{0}?ajax=true'.format(generated_ezgif_filename),data=payload).text 1316 | 1317 | soup = BeautifulSoup(convert_response,'html.parser') 1318 | gif = soup.find('a',{'m-btn-crop'}) 1319 | gif = gif['href'] 1320 | 1321 | embed_message = discord.Embed(description='**[GENERATED GIF FROM MP4]**') 1322 | embed_message.set_author(name="{0}".format(self.author_dc), icon_url="{0}".format(self.icon_url)) 1323 | embed_message.add_field(name="URL", value=gif,inline=False) 1324 | embed_message.set_image(url=gif) 1325 | embed_message.set_footer(text='REQUESTED: {0}\n{1}'.format(ctx.message.author.name,self.embed_footer_message)) 1326 | embed_message.colour = self.embed_colour 1327 | await ctx.send(embed=embed_message) 1328 | except: 1329 | pass 1330 | 1331 | self.bot.run(self.token,bot=True) 1332 | 1333 | if __name__ == '__main__': 1334 | main = Main() 1335 | main.Start() 1336 | 1337 | 1338 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.24.0 2 | discord_webhook==0.11.0 3 | discord.py==1.5.1 4 | beautifulsoup4==4.9.3 5 | discord==1.0.1 6 | praw==7.1.0 --------------------------------------------------------------------------------