From 133cccc01a1f174c142b4703c78d7e7184905523 Mon Sep 17 00:00:00 2001 From: Midhun Manesh Date: Fri, 3 Jul 2026 21:50:01 +0530 Subject: [PATCH] feat: improve YouTube download reliability --- backend/app.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/backend/app.py b/backend/app.py index f91c5dc..13e5995 100644 --- a/backend/app.py +++ b/backend/app.py @@ -26,7 +26,7 @@ def download(): ydl_opts = { 'format': 'bestaudio', 'outtmpl': f'{DOWNLOAD_FOLDER}/%(title)s.%(ext)s', - + 'impersonate': 'chrome', 'extractor_args': { 'youtube': { 'player_client': ['android'] @@ -35,8 +35,10 @@ def download(): 'geo_bypass': True, 'noplaylist': True, - 'quiet': False, - 'nocheckcertificate': True + 'quiet': True, + 'no_warnings': True, + 'retries': 5, + 'extractor_retries': 5 } else: @@ -47,7 +49,7 @@ def download(): 'format': f'bestvideo[height<={height}]+bestaudio/best', 'merge_output_format': 'mp4', 'outtmpl': f'{DOWNLOAD_FOLDER}/%(title)s.%(ext)s', - + 'impersonate': 'chrome', 'extractor_args': { 'youtube': { 'player_client': ['android'] @@ -56,8 +58,10 @@ def download(): 'geo_bypass': True, 'noplaylist': True, - 'quiet': False, - 'nocheckcertificate': True + 'quiet': True, + 'no_warnings': True, + 'retries': 5, + 'extractor_retries': 5 } try: @@ -96,16 +100,9 @@ def cleanup(response): return f"""

Download Failed-Retry

-

{str(e)}

-
- - - - + """,400