pop out missing subtitle
This commit is contained in:
parent
2d10853225
commit
50a252d3b7
1 changed files with 33 additions and 0 deletions
|
@ -419,6 +419,39 @@ class GetYoutubeVideos:
|
||||||
)
|
)
|
||||||
self.summary['videos_with_error'] += 1
|
self.summary['videos_with_error'] += 1
|
||||||
break
|
break
|
||||||
|
elif 'Unable to download video subtitles for' in f"{error}":
|
||||||
|
subtitle_match = re.match(
|
||||||
|
r"Unable to download video subtitles for '([a-z]*)' ",
|
||||||
|
f"{error}"
|
||||||
|
)
|
||||||
|
if not subtitle_match:
|
||||||
|
self._log.error(
|
||||||
|
f"Error finding subtitle that failed in error string"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
ydl_opts['subtitleslangs'].pop(subtitle_match.group(1))
|
||||||
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||||
|
try:
|
||||||
|
uri=f"https://www.youtube.com/watch?v={video_id}"
|
||||||
|
return_code = ydl.download(uri)
|
||||||
|
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:
|
else:
|
||||||
self._log.error(
|
self._log.error(
|
||||||
"Error getting video with proxy '%s'. %s",
|
"Error getting video with proxy '%s'. %s",
|
||||||
|
|
Loading…
Reference in a new issue