change proxy if too many requests
This commit is contained in:
parent
cab21448cd
commit
ed5b67ee79
1 changed files with 10 additions and 1 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue