fix unavailable video crash
This commit is contained in:
parent
b84710b222
commit
77c2202624
|
@ -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']):
|
||||
|
|
Reference in New Issue