replaced remaining data[key] with data.get(key)
This commit is contained in:
parent
fc75a2d468
commit
c7eb72b397
@ -68,12 +68,14 @@ class CBAIE(InfoExtractor):
|
||||
media_result = self._download_json(api_media_url, video_id, 'query media api-endpoint%s' % api_key_msg,
|
||||
'unable to qeury media api-endpoint%s' % api_key_msg, encoding='utf-8-sig')
|
||||
for media in media_result:
|
||||
try:
|
||||
url = media['source_url']
|
||||
url = media.get('source_url')
|
||||
if not url:
|
||||
continue
|
||||
|
||||
ft = media['mime_type']
|
||||
ft = media.get('mime_type')
|
||||
if not ft or not self._FORMATS.get(ft):
|
||||
continue
|
||||
|
||||
f = { 'url': url, 'format': ft, 'format_id': self._FORMATS[ft]['id'], 'preference': self._FORMATS[ft]['preference'] }
|
||||
media_details = media.get('media_details')
|
||||
if media_details:
|
||||
@ -82,8 +84,6 @@ class CBAIE(InfoExtractor):
|
||||
f['asr'] = int_or_none(media_details.get('sample_rate'))
|
||||
|
||||
formats.append(f)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if not formats:
|
||||
if api_key:
|
||||
|
Loading…
x
Reference in New Issue
Block a user