From b3a589f1a9d4f84e180623cb32cb826579f52553 Mon Sep 17 00:00:00 2001 From: asuyou Date: Mon, 25 Oct 2021 17:15:09 +0100 Subject: Added simple MP3 support --- app/ytdl.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app') diff --git a/app/ytdl.py b/app/ytdl.py index f9084e3..0400877 100644 --- a/app/ytdl.py +++ b/app/ytdl.py @@ -39,6 +39,14 @@ class Download: vfmt, afmt = '', '' if format == 'mp4': vfmt, afmt = '[ext=mp4]', '[ext=m4a]' + elif format == 'mp3': + afmt = '/best' + ytdl_opts["writethumbnail"] = True + ytdl_opts["postprocessors"] = [ + {"key": "FFmpegExtractAudio", "preferredcodec": "mp3"}, + {"key": "EmbedThumbnail"}, + ] + if quality == 'best': self.format = f'bestvideo{vfmt}+bestaudio{afmt}/best{vfmt}' elif quality in ('1440p', '1080p', '720p', '480p'): -- cgit