diff --git a/get_youtube_videos/get_youtube_videos.py b/get_youtube_videos/get_youtube_videos.py index 6c71857..963fd3d 100644 --- a/get_youtube_videos/get_youtube_videos.py +++ b/get_youtube_videos/get_youtube_videos.py @@ -384,7 +384,12 @@ class GetYoutubeVideos: if self.selected_proxy != '': ydl_opts['proxy'] = self.selected_proxy download_result = 'starting' - while 'downloaded' not in download_result and 'error' not in download_result: + retries = 0 + while 'downloaded' not in download_result and 'error' not in download_result and retries < 30: + if retries > 0: + self._log.debug( + f"Retry: {retries}" + ) self._log.debug( f"Download status: {download_result}" ) @@ -446,6 +451,7 @@ class GetYoutubeVideos: self.summary['videos_with_error'] += 1 download_result = error continue + retries += 1 else: self._log.debug( "Video with ID '%s' has been already downloaded",