fix(youtubedownloader): pylint fixes
All checks were successful
Pylint / Pylint (3.10) (push) Successful in 53s
All checks were successful
Pylint / Pylint (3.10) (push) Successful in 53s
This commit is contained in:
parent
7a9692b50c
commit
5603b88959
1 changed files with 4 additions and 7 deletions
|
@ -60,9 +60,9 @@ class YouTubeDownloader(commands.Cog):
|
||||||
try:
|
try:
|
||||||
self.blacklist_checker(ctx.author.id)
|
self.blacklist_checker(ctx.author.id)
|
||||||
except self.UserBlacklisted:
|
except self.UserBlacklisted:
|
||||||
await ctx.send(f"You are blacklisted from running this command!")
|
await ctx.send("You are blacklisted from running this command!")
|
||||||
return
|
return
|
||||||
def youtube_download(self, url: str, path: str):
|
def youtube_download(url: str, path: str):
|
||||||
"""This function does the actual downloading of the YouTube Video."""
|
"""This function does the actual downloading of the YouTube Video."""
|
||||||
yt = YouTube(url=url)
|
yt = YouTube(url=url)
|
||||||
filename = f"{yt.title} ({yt.video_id})"
|
filename = f"{yt.title} ({yt.video_id})"
|
||||||
|
@ -74,10 +74,7 @@ class YouTubeDownloader(commands.Cog):
|
||||||
stream = yt.streams.filter(progressive=True, mime_type='video/mp4')
|
stream = yt.streams.filter(progressive=True, mime_type='video/mp4')
|
||||||
stream = stream.order_by('resolution')
|
stream = stream.order_by('resolution')
|
||||||
filename_format = filename + ".mp4"
|
filename_format = filename + ".mp4"
|
||||||
if os.path.isfile(path + f"{os.sep}{filename_format}"):
|
previously_existed = bool(os.path.isfile(path + f"{os.sep}{filename_format}"))
|
||||||
previously_existed = True
|
|
||||||
else:
|
|
||||||
previously_existed = False
|
|
||||||
return stream.desc().first().download(filename=filename, output_path=path), previously_existed, filename_format
|
return stream.desc().first().download(filename=filename, output_path=path), previously_existed, filename_format
|
||||||
data_path = await self.config.save_directory()
|
data_path = await self.config.save_directory()
|
||||||
if subfolder and await self.bot.is_owner(ctx.author):
|
if subfolder and await self.bot.is_owner(ctx.author):
|
||||||
|
@ -108,7 +105,7 @@ class YouTubeDownloader(commands.Cog):
|
||||||
msg = ctx.send
|
msg = ctx.send
|
||||||
message = await msg("YouTube Downloader started!")
|
message = await msg("YouTube Downloader started!")
|
||||||
try:
|
try:
|
||||||
output = youtube_download(self, url, data_path)
|
output = youtube_download(url, data_path)
|
||||||
except exceptions.RegexMatchError:
|
except exceptions.RegexMatchError:
|
||||||
await message.edit(content="Please provide a link to YouTube and not another site.")
|
await message.edit(content="Please provide a link to YouTube and not another site.")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue