From: Christian Heller Date: Tue, 5 Nov 2024 03:40:59 +0000 (+0100) Subject: Limit download video resolution to max. full HD. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/blog?a=commitdiff_plain;h=b93f7a1ae50bf85fba121eb63036ac0a239f7856;p=ytplom Limit download video resolution to max. full HD. --- diff --git a/ytplom.py b/ytplom.py index 1dbd147..370f504 100755 --- a/ytplom.py +++ b/ytplom.py @@ -103,7 +103,10 @@ def download_thread(): except IndexError: continue url = f'{YOUTUBE_URL_PREFIX}{video_id}' - params = {'paths': {'home': PATH_DIR_DOWNLOADS, 'temp': NAME_DIR_TEMP}} + fmt = 'bestvideo[height<=1080][width<=1920]+bestaudio'\ + '/best[height<=1080][width<=1920]' + params = {'paths': {'home': PATH_DIR_DOWNLOADS, 'temp': NAME_DIR_TEMP}, + 'format': fmt} with YoutubeDL(params) as ydl: ydl.download([url])