change proxy if too many requests

This commit is contained in:
Antonio J. Delgado 2025-08-02 08:21:18 +03:00
parent cab21448cd
commit ed5b67ee79

View file

@ -226,6 +226,13 @@ class GetYoutubeVideos:
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
return result
# if 'This live event will begin in a few moments' in f"{error}":
# self.summary['skipped_videos'] += 1
self.summary['skipped_videos'] += 1
@ -414,7 +421,9 @@ class GetYoutubeVideos:
)
self.summary['videos_with_error'] += 1
break
self.summary['downloaded_videos_titles'].append(video_info.get('title', '?'))
self.summary['downloaded_videos_titles'].append(
video_info.get('title', '?')
)
self.summary['downloaded_videos'] += 1
else:
self._log.debug(