From ef376d489856c586ec138266fa0d436b4cbefb92 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Mon, 15 Sep 2025 10:36:28 +0300 Subject: [PATCH] check proxy list --- get_youtube_videos/get_youtube_videos.py | 48 ++++++++++++++---------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/get_youtube_videos/get_youtube_videos.py b/get_youtube_videos/get_youtube_videos.py index a69b037..11c8b1f 100644 --- a/get_youtube_videos/get_youtube_videos.py +++ b/get_youtube_videos/get_youtube_videos.py @@ -215,37 +215,45 @@ class GetYoutubeVideos: return None return result if 'HTTP Error 403: Forbidden' in f"{error}": - result = self._change_proxy(video_id) - if not result: - self.summary['videos_with_error'] += 1 - self.summary['possible_proxy_errors'] += 1 - return None + result = None + if 'proxy' in self.config and len(self.config['proxy']) > 0: + result = self._change_proxy(video_id) + if not result: + self.summary['videos_with_error'] += 1 + self.summary['possible_proxy_errors'] += 1 + return None return result if 'not a bot' in f"{error}": # elif age_limit_errors? - result = self._change_proxy(video_id) - if not result: - self.summary['videos_with_error'] += 1 - self.summary['possible_ban_errors'] += 1 - return None + result = None + if 'proxy' in self.config and len(self.config['proxy']) > 0: + result = self._change_proxy(video_id) + if not result: + self.summary['videos_with_error'] += 1 + self.summary['possible_ban_errors'] += 1 + return None return result if 'Failed to extract any player response' in f"{error}": self._log.error( "Possible error connecting to proxy '%s'", self.selected_proxy ) - result = self._change_proxy(video_id) - if not result: - self.summary['videos_with_error'] += 1 - self.summary['possible_proxy_errors'] += 1 - return None + result = None + if 'proxy' in self.config and len(self.config['proxy']) > 0: + result = self._change_proxy(video_id) + if not result: + self.summary['videos_with_error'] += 1 + self.summary['possible_proxy_errors'] += 1 + return None return result if 'HTTP Error 429: Too Many Requests' in f"{error}": - result = self._change_proxy(video_id) - if not result: - self.summary['videos_with_error'] += 1 - self.summary['possible_proxy_errors'] += 1 - return None + result = None + if 'proxy' in self.config and len(self.config['proxy']) > 0: + result = self._change_proxy(video_id) + if not result: + self.summary['videos_with_error'] += 1 + self.summary['possible_proxy_errors'] += 1 + return None return result # if 'This live event will begin in a few moments' in f"{error}": # self.summary['skipped_videos'] += 1