|
|
@ -3,11 +3,12 @@ from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
|
|
|
|
parse_iso8601,
|
|
|
|
|
|
|
|
mimetype2ext,
|
|
|
|
|
|
|
|
determine_ext,
|
|
|
|
determine_ext,
|
|
|
|
ExtractorError,
|
|
|
|
ExtractorError,
|
|
|
|
|
|
|
|
int_or_none,
|
|
|
|
|
|
|
|
mimetype2ext,
|
|
|
|
|
|
|
|
parse_iso8601,
|
|
|
|
|
|
|
|
url_or_none,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -35,7 +36,7 @@ class AMPIE(InfoExtractor):
|
|
|
|
media_thumbnail = [media_thumbnail]
|
|
|
|
media_thumbnail = [media_thumbnail]
|
|
|
|
for thumbnail_data in media_thumbnail:
|
|
|
|
for thumbnail_data in media_thumbnail:
|
|
|
|
thumbnail = thumbnail_data.get('@attributes', {})
|
|
|
|
thumbnail = thumbnail_data.get('@attributes', {})
|
|
|
|
thumbnail_url = thumbnail.get('url')
|
|
|
|
thumbnail_url = url_or_none(thumbnail.get('url'))
|
|
|
|
if not thumbnail_url:
|
|
|
|
if not thumbnail_url:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
thumbnails.append({
|
|
|
|
thumbnails.append({
|
|
|
@ -51,7 +52,7 @@ class AMPIE(InfoExtractor):
|
|
|
|
media_subtitle = [media_subtitle]
|
|
|
|
media_subtitle = [media_subtitle]
|
|
|
|
for subtitle_data in media_subtitle:
|
|
|
|
for subtitle_data in media_subtitle:
|
|
|
|
subtitle = subtitle_data.get('@attributes', {})
|
|
|
|
subtitle = subtitle_data.get('@attributes', {})
|
|
|
|
subtitle_href = subtitle.get('href')
|
|
|
|
subtitle_href = url_or_none(subtitle.get('href'))
|
|
|
|
if not subtitle_href:
|
|
|
|
if not subtitle_href:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
subtitles.setdefault(subtitle.get('lang') or 'en', []).append({
|
|
|
|
subtitles.setdefault(subtitle.get('lang') or 'en', []).append({
|
|
|
@ -65,7 +66,7 @@ class AMPIE(InfoExtractor):
|
|
|
|
media_content = [media_content]
|
|
|
|
media_content = [media_content]
|
|
|
|
for media_data in media_content:
|
|
|
|
for media_data in media_content:
|
|
|
|
media = media_data.get('@attributes', {})
|
|
|
|
media = media_data.get('@attributes', {})
|
|
|
|
media_url = media.get('url')
|
|
|
|
media_url = url_or_none(media.get('url'))
|
|
|
|
if not media_url:
|
|
|
|
if not media_url:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
ext = mimetype2ext(media.get('type')) or determine_ext(media_url)
|
|
|
|
ext = mimetype2ext(media.get('type')) or determine_ext(media_url)
|
|
|
@ -79,7 +80,7 @@ class AMPIE(InfoExtractor):
|
|
|
|
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,
|
|
|
|
'ext': ext,
|
|
|
|