fix(youtubedownloader): fixed downloading the first video stream
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 53s
This commit is contained in:
parent
af27593fa9
commit
229aaa77d5
1 changed files with 3 additions and 5 deletions
|
@ -67,18 +67,16 @@ class YouTubeDownloader(commands.Cog):
|
|||
yt = YouTube(url=url)
|
||||
filename = f"{yt.title} ({yt.video_id})"
|
||||
if audio_only:
|
||||
yt.streams.filter(only_audio=True, mime_type='audio/mp4')
|
||||
yt.streams.order_by('abr')
|
||||
stream = yt.streams.filter(only_audio=True, mime_type='audio/mp4').order_by('abr')
|
||||
filename_format = filename + ".m4a"
|
||||
else:
|
||||
yt.streams.filter(progressive=True, mime_type="video/mp4")
|
||||
yt.streams.order_by('resolution')
|
||||
stream = yt.streams.filter(progressive=True, mime_type='video/mp4').order_by('res')
|
||||
filename_format = filename + ".mp4"
|
||||
if os.path.isfile(path + f"{os.sep}{filename_format}"):
|
||||
previously_existed = True
|
||||
else:
|
||||
previously_existed = False
|
||||
return yt.streams.first().download(filename=filename, output_path=path), previously_existed, filename_format
|
||||
return stream.first().download(filename=filename, output_path=path), previously_existed, filename_format
|
||||
data_path = await self.config.save_directory()
|
||||
if subfolder and await self.bot.is_owner(ctx.author):
|
||||
data_path = os.path.join(data_path, subfolder)
|
||||
|
|
Loading…
Reference in a new issue