fix: allow_unplayable_formats removed, reply_video, auto-select 480p, remove file sizes

This commit is contained in:
vrubelroman 2026-05-03 02:39:27 +03:00
parent 839cd57f6f
commit 59b1c54668
2 changed files with 74 additions and 17 deletions

View file

@ -334,12 +334,7 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
ydl_opts_download.update({
'format': format_option,
'outtmpl': _safe_filename(video_title),
# fragment_retries — для DASH форматов (видео без аудио),
# YouTube может разрывать фрагменты; увеличиваем retries
'fragment_retries': 3,
# allow_unplayable_formats — позволяет скачивать форматы,
# которые YouTube помечает как "недоступные" для сторонних клиентов
'allow_unplayable_formats': True,
})
use_cookies_this_attempt = cookies_valid
@ -392,7 +387,6 @@ def download_youtube_video(url: str, max_retries: int = 3, format_id: str | None
'format': format_option,
'outtmpl': _safe_filename(video_title),
'fragment_retries': 3,
'allow_unplayable_formats': True,
})
try:
with yt_dlp.YoutubeDL(ydl_opts_download_no_cookies) as ydl: