- if 'type' and 'url' in target:
- extension = utils.determine_ext(target['url'])
- if target['type'] == 'PROGRESSIVE_DOWNLOAD':
- formats.append({
- 'format_id': extension,
- 'url': target['url'],
- 'protocol': 'http',
- })
- elif target['type'] == 'HLS':
- formats.extend(self._extract_m3u8_formats(
- target['url'], video_id, entry_protocol='m3u8_native',
- ext='mp4',
- preference=0,
- fatal=False,
- m3u8_id='hls'))
- elif target['type'] == 'HDS':
- formats.append({
- 'format_id': extension,
- 'url': target['url'],
- 'protocol': 'HDS',
- })
- elif target['type'] == 'RTMP':
- formats.append({
- 'format_id': extension,
- 'url': target['url'],
- 'protocol': 'rtmp',
- })
- elif target['type'] == 'RTSP':
- formats.append({
- 'format_id': extension,
- 'url': target['url'],
- 'protocol': 'rtsp',
- })
-
+ format_url, format_type = target.get('url'), target.get('type')
+ if not format_url or not format_type:
+ continue
+ if format_type == 'HLS':
+ formats.extend(self._extract_m3u8_formats(
+ format_url, display_id, entry_protocol='m3u8_native',
+ ext='mp4', preference=0, fatal=False, m3u8_id=format_type))
+ elif format_type == 'HDS':
+ formats.extend(self._extract_f4m_formats(
+ format_url, display_id, f4m_id=format_type, fatal=False))
+ elif format_type == 'MPEG_DASH':
+ formats.extend(self._extract_mpd_formats(
+ format_url, display_id, mpd_id=format_type, fatal=False))
+ else:
+ formats.append({
+ 'format_id': format_type,
+ 'url': format_url,
+ })