[azubu] Don't fail on optional fields
This commit is contained in:
parent
573c35272f
commit
1f35745758
1 changed files with 12 additions and 7 deletions
|
@ -46,6 +46,7 @@ class AzubuIE(InfoExtractor):
|
||||||
'uploader_id': 272749,
|
'uploader_id': 272749,
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
},
|
},
|
||||||
|
'skip': 'Channel offline',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -56,22 +57,26 @@ class AzubuIE(InfoExtractor):
|
||||||
'http://www.azubu.tv/api/video/%s' % video_id, video_id)['data']
|
'http://www.azubu.tv/api/video/%s' % video_id, video_id)['data']
|
||||||
|
|
||||||
title = data['title'].strip()
|
title = data['title'].strip()
|
||||||
description = data['description']
|
description = data.get('description')
|
||||||
thumbnail = data['thumbnail']
|
thumbnail = data.get('thumbnail')
|
||||||
view_count = data['view_count']
|
view_count = data.get('view_count')
|
||||||
uploader = data['user']['username']
|
user = data.get('user', {})
|
||||||
uploader_id = data['user']['id']
|
uploader = user.get('username')
|
||||||
|
uploader_id = user.get('id')
|
||||||
|
|
||||||
stream_params = json.loads(data['stream_params'])
|
stream_params = json.loads(data['stream_params'])
|
||||||
|
|
||||||
timestamp = float_or_none(stream_params['creationDate'], 1000)
|
timestamp = float_or_none(stream_params.get('creationDate'), 1000)
|
||||||
duration = float_or_none(stream_params['length'], 1000)
|
duration = float_or_none(stream_params.get('length'), 1000)
|
||||||
|
|
||||||
renditions = stream_params.get('renditions') or []
|
renditions = stream_params.get('renditions') or []
|
||||||
video = stream_params.get('FLVFullLength') or stream_params.get('videoFullLength')
|
video = stream_params.get('FLVFullLength') or stream_params.get('videoFullLength')
|
||||||
if video:
|
if video:
|
||||||
renditions.append(video)
|
renditions.append(video)
|
||||||
|
|
||||||
|
if not renditions and not user.get('channel', {}).get('is_live', True):
|
||||||
|
raise ExtractorError('%s said: channel is offline.' % self.IE_NAME, expected=True)
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': fmt['url'],
|
'url': fmt['url'],
|
||||||
'width': fmt['frameWidth'],
|
'width': fmt['frameWidth'],
|
||||||
|
|
Loading…
Reference in a new issue