Intercept youtube-dl output

This commit is contained in:
Serene-Arc
2021-05-02 19:49:32 +10:00
committed by Serene
parent a8c2136270
commit fba70dcf18

View File

@@ -30,7 +30,10 @@ class Youtube(BaseDownloader):
return [out] return [out]
def _download_video(self, ytdl_options: dict) -> Resource: def _download_video(self, ytdl_options: dict) -> Resource:
yt_logger = logging.getLogger('youtube-dl')
yt_logger.setLevel(logging.CRITICAL)
ytdl_options['quiet'] = True ytdl_options['quiet'] = True
ytdl_options['logger'] = yt_logger
with tempfile.TemporaryDirectory() as temp_dir: with tempfile.TemporaryDirectory() as temp_dir:
download_path = Path(temp_dir).resolve() download_path = Path(temp_dir).resolve()
ytdl_options['outtmpl'] = str(download_path) + '/' + 'test.%(ext)s' ytdl_options['outtmpl'] = str(download_path) + '/' + 'test.%(ext)s'