fix(youtubedownlaoder): hopefully fixed downloading videos
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s

This commit is contained in:
Seaswimmer 2023-10-24 00:36:49 -04:00
parent b45bddc548
commit 1d666a569c
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -72,13 +72,13 @@ class YouTubeDownloader(commands.Cog):
filename_format = filename + ".m4a" filename_format = filename + ".m4a"
else: else:
stream = yt.streams.filter(progressive=True, mime_type='video/mp4') stream = yt.streams.filter(progressive=True, mime_type='video/mp4')
stream = stream.order_by('res') stream = stream.order_by('resolution')
filename_format = filename + ".mp4" filename_format = filename + ".mp4"
if os.path.isfile(path + f"{os.sep}{filename_format}"): if os.path.isfile(path + f"{os.sep}{filename_format}"):
previously_existed = True previously_existed = True
else: else:
previously_existed = False previously_existed = False
return stream.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):
data_path = os.path.join(data_path, subfolder) data_path = os.path.join(data_path, subfolder)