test for format error
This commit is contained in:
parent
795a9d892d
commit
c5ede0c21f
1 changed files with 32 additions and 7 deletions
|
@ -324,13 +324,38 @@ class GetYoutubeVideos:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except yt_dlp.utils.DownloadError as error:
|
except yt_dlp.utils.DownloadError as error:
|
||||||
self._log.error(
|
if 'Requested format is not available' in f"{error}":
|
||||||
"Error getting video with proxy '%s'. %s",
|
ydl_opts['format'] = 'bestvideo+bestaudio[ext=m4a]/best'
|
||||||
self.selected_proxy,
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
error
|
try:
|
||||||
)
|
uri=f"https://www.youtube.com/watch?v={video_id}"
|
||||||
self.summary['videos_with_error'] += 1
|
return_code = ydl.download(uri)
|
||||||
break
|
self._process_download(
|
||||||
|
{
|
||||||
|
"return_code": return_code,
|
||||||
|
'info_dict': {
|
||||||
|
'id': video_id,
|
||||||
|
},
|
||||||
|
'filename': video_info.get('title', '?'),
|
||||||
|
'video_info': video_info,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
except yt_dlp.utils.DownloadError as sub_error:
|
||||||
|
self._log.error(
|
||||||
|
"Error getting video with proxy '%s'. %s",
|
||||||
|
self.selected_proxy,
|
||||||
|
sub_error
|
||||||
|
)
|
||||||
|
self.summary['videos_with_error'] += 1
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self._log.error(
|
||||||
|
"Error getting video with proxy '%s'. %s",
|
||||||
|
self.selected_proxy,
|
||||||
|
error
|
||||||
|
)
|
||||||
|
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
|
self.summary['downloaded_videos'] += 1
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue