- format_info = formats[-1]
- if format_info['mediaType'] == u'rtmp':
- info_dict['url'] = format_info['streamer']
- info_dict['play_path'] = 'mp4:' + format_info['url']
- else:
- info_dict['url'] = format_info['url']
+ def _format(format_info):
+ info = {'ext': 'flv',
+ 'width': format_info.get('width'),
+ 'height': format_info.get('height'),
+ }
+ if format_info['mediaType'] == u'rtmp':
+ info['url'] = format_info['streamer']
+ info['play_path'] = 'mp4:' + format_info['url']
+ else:
+ info_dict['url'] = format_info['url']
+ return info
+ info_dict['formats'] = [_format(f) for f in formats]
+ # TODO: Remove when #980 has been merged
+ info_dict.update(info_dict['formats'][-1])