-
- formats = [{
- 'id': video_id,
- 'url': base_url + hd_file,
- 'format': 'hd',
- 'ext': 'mp4',
- 'title': video_title,
- 'description': video_description,
- 'upload_date': video_date,
- 'thumbnail': video_thumbnail,
- },
- {
- 'id': video_id,
- 'url': base_url + sd_file,
- 'ext': 'mp4',
- 'format': 'sd',
- 'title': video_title,
- 'description': video_description,
- 'upload_date': video_date,
- 'thumbnail': video_thumbnail,
- }]
-
- if self._downloader.params.get('listformats', None):
- self._print_formats(formats)
- return
-
- req_format = self._downloader.params.get('format', 'best')
- self.to_screen(u'Format: %s' % req_format)
-
- if req_format is None or req_format == 'best':
- return [formats[0]]
- elif req_format == 'worst':
- return [formats[-1]]
- elif req_format in ('-1', 'all'):
- return formats
- else:
- format = self._specific( req_format, formats )
- if format is None:
- raise ExtractorError(u'Requested format not available')
- return [format]