- # TODO: support choosing qualities
-
- for key in ['stream_h264_hd1080_url','stream_h264_hd_url',
- 'stream_h264_hq_url','stream_h264_url',
- 'stream_h264_ld_url']:
- if info.get(key):#key in info and info[key]:
- max_quality = key
- self.to_screen(u'Using %s' % key)
- break
- else:
+ formats = []
+ for (key, format_id) in self._FORMATS:
+ video_url = info.get(key)
+ if video_url is not None:
+ m_size = re.search(r'H264-(\d+)x(\d+)', video_url)
+ if m_size is not None:
+ width, height = m_size.group(1), m_size.group(2)
+ else:
+ width, height = None, None
+ formats.append({
+ 'url': video_url,
+ 'ext': 'mp4',
+ 'format_id': format_id,
+ 'width': width,
+ 'height': height,
+ })
+ if not formats: