fix unavailable video crash

This commit is contained in:
Cyberes 2023-05-06 18:29:14 -06:00
parent b84710b222
commit 77c2202624
1 changed files with 5 additions and 5 deletions

View File

@ -80,13 +80,9 @@ def download_video(args) -> dict:
video = args[0]
kwargs = args[1]
# Clean the strings of forign languages
video['title'] = unidecode(video['title'])
video['uploader'] = unidecode(video['uploader'])
output_dict = {'downloaded_video_id': None, 'video_id': video['id'], 'video_critical_err_msg': [], 'video_critical_err_msg_short': [], 'status_msg': [], 'logger_msg': []} # empty object
if not kwargs['ignore_downloaded'] and not video['channel_id'] or not video['channel'] or not video['channel_url']:
if not kwargs['ignore_downloaded'] and not video['channel_id'] or not video['channel'] or not video['channel_url'] or 'uploader' not in video.keys():
if video['duration'] or isinstance(video['view_count'], int):
# Sometimes videos don't have channel_id, channel, or channel_url but are actually valid. Like shorts.
pass
@ -94,6 +90,10 @@ def download_video(args) -> dict:
output_dict['video_critical_err_msg_short'].append('unavailable.')
return output_dict
# Clean the strings of forign languages
video['title'] = unidecode(video['title'])
video['uploader'] = unidecode(video['uploader'])
# Get a bar
locked = False
if len(kwargs['bars']):