From 9b376abfc54f78d980afc480da839893c860b344 Mon Sep 17 00:00:00 2001 From: pluja Date: Mon, 5 Oct 2020 15:20:08 +0200 Subject: [PATCH] Catch ydl errors --- youtube_data/videos.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/youtube_data/videos.py b/youtube_data/videos.py index d8644f2..543007c 100644 --- a/youtube_data/videos.py +++ b/youtube_data/videos.py @@ -126,9 +126,13 @@ def get_video_primary_info(datad, datai): ydl = YoutubeDL() - data = ydl.extract_info(details['videoId'], False) - while not data['formats']: + try: data = ydl.extract_info(details['videoId'], False) + while not data['formats']: + data = ydl.extract_info(details['videoId'], False) + except Exception as e: + premieres = e + ## Get audio audio_urls = []