From 4a20b7d94e4898f4bdae6472224ca4c92effe9ff Mon Sep 17 00:00:00 2001 From: Ali Hamdi Ali Fadel Date: Fri, 1 Nov 2024 08:21:57 +0000 Subject: [PATCH] Add extract_flat option to yt-dlp config to reduce API calls --- tafrigh/downloader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tafrigh/downloader.py b/tafrigh/downloader.py index 4cb8966..e6e23af 100644 --- a/tafrigh/downloader.py +++ b/tafrigh/downloader.py @@ -15,13 +15,12 @@ def __init__(self, playlist_items: str, output_dir: str): def _config(self, download_archive: str | bool) -> dict[str, Any]: return { - 'quiet': True, - 'verbose': False, - 'format': 'bestaudio', + 'download_archive': download_archive, 'extract_audio': True, - 'outtmpl': os.path.join(self.output_dir, '%(id)s.%(ext)s'), + 'extract_flat': True, + 'format': 'bestaudio', 'ignoreerrors': True, - 'download_archive': download_archive, + 'outtmpl': os.path.join(self.output_dir, '%(id)s.%(ext)s'), 'playlist_items': self.playlist_items, 'postprocessors': [ { @@ -29,6 +28,8 @@ def _config(self, download_archive: str | bool) -> dict[str, Any]: 'preferredcodec': 'mp3', }, ], + 'quiet': True, + 'verbose': False, } def download(self, url: str, retries: int = 3, save_response: bool = False) -> dict[str, Any]: