|
|
@ -5,6 +5,8 @@ from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
int_or_none,
|
|
|
|
parse_iso8601,
|
|
|
|
parse_iso8601,
|
|
|
|
|
|
|
|
mimetype2ext,
|
|
|
|
|
|
|
|
determine_ext,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,21 +52,25 @@ class AMPIE(InfoExtractor):
|
|
|
|
if isinstance(media_content, dict):
|
|
|
|
if isinstance(media_content, dict):
|
|
|
|
media_content = [media_content]
|
|
|
|
media_content = [media_content]
|
|
|
|
for media_data in media_content:
|
|
|
|
for media_data in media_content:
|
|
|
|
media = media_data['@attributes']
|
|
|
|
media = media_data.get('@attributes', {})
|
|
|
|
media_type = media['type']
|
|
|
|
media_url = media.get('url')
|
|
|
|
if media_type in ('video/f4m', 'application/f4m+xml'):
|
|
|
|
if not media_url:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
ext = mimetype2ext(media.get('type')) or determne_ext(media_url)
|
|
|
|
|
|
|
|
if ext == 'f4m':
|
|
|
|
formats.extend(self._extract_f4m_formats(
|
|
|
|
formats.extend(self._extract_f4m_formats(
|
|
|
|
media['url'] + '?hdcore=3.4.0&plugin=aasp-3.4.0.132.124',
|
|
|
|
media_url + '?hdcore=3.4.0&plugin=aasp-3.4.0.132.124',
|
|
|
|
video_id, f4m_id='hds', fatal=False))
|
|
|
|
video_id, f4m_id='hds', fatal=False))
|
|
|
|
elif media_type == 'application/x-mpegURL':
|
|
|
|
elif ext == 'm3u8':
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
|
|
|
media['url'], video_id, 'mp4', m3u8_id='hls', fatal=False))
|
|
|
|
media_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
formats.append({
|
|
|
|
formats.append({
|
|
|
|
'format_id': media_data.get('media-category', {}).get('@attributes', {}).get('label'),
|
|
|
|
'format_id': media_data.get('media-category', {}).get('@attributes', {}).get('label'),
|
|
|
|
'url': media['url'],
|
|
|
|
'url': media['url'],
|
|
|
|
'tbr': int_or_none(media.get('bitrate')),
|
|
|
|
'tbr': int_or_none(media.get('bitrate')),
|
|
|
|
'filesize': int_or_none(media.get('fileSize')),
|
|
|
|
'filesize': int_or_none(media.get('fileSize')),
|
|
|
|
|
|
|
|
'ext': ext,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
self._sort_formats(formats)
|
|
|
|
self._sort_formats(formats)
|
|
|
|