- entry_attr = entry['attr']
- codec = entry_attr['val0']
- quality = int(entry_attr['val1'])
-
- fmt = {
- 'url': entry_attr['val2'],
- 'quality': quality,
- }
-
- if media_type == 'Video':
- fmt.update({
- 'format_note': ['144p', '288p', '544p'][quality-1],
- 'vcodec': codec,
- })
- elif media_type == 'Audio':
- fmt.update({
- 'acodec': codec,
+ entry_attr = entry.get('attr', {})
+ f_url = entry_attr.get('val2')
+ if not f_url:
+ continue
+ codec = entry_attr.get('val0')
+ if codec == 'm3u8':
+ formats.extend(self._extract_m3u8_formats(
+ f_url, video_id, 'mp4', 'm3u8_native',
+ m3u8_id='hls', fatal=False))
+ elif codec == 'f4m':
+ formats.extend(self._extract_f4m_formats(
+ f_url + '?hdcore=3.7.0', video_id,
+ f4m_id='hds', fatal=False))
+ else:
+ formats.append({
+ 'format_id': determine_protocol({'url': f_url}),
+ 'url': f_url,
+ 'quality': int_or_none(entry_attr.get('val1')),
+ 'vcodec': codec if media_type == 'Video' else 'none',
+ 'acodec': codec if media_type == 'Audio' else None,