[turner] extract thumbnail and is_live and strip description

This commit is contained in:
Remita Amine 2017-05-08 15:00:57 +01:00
parent bf82b87323
commit 04c09f1961

View file

@ -13,6 +13,7 @@ from ..utils import (
xpath_attr, xpath_attr,
update_url_query, update_url_query,
ExtractorError, ExtractorError,
strip_or_none,
) )
@ -163,17 +164,21 @@ class TurnerBaseIE(AdobePassIE):
'height': int_or_none(image.get('height')), 'height': int_or_none(image.get('height')),
} for image in video_data.findall('images/image')] } for image in video_data.findall('images/image')]
is_live = xpath_text(video_data, 'isLive') == 'true'
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': self._live_title(title) if is_live else title,
'formats': formats, 'formats': formats,
'subtitles': subtitles, 'subtitles': subtitles,
'thumbnails': thumbnails, 'thumbnails': thumbnails,
'description': xpath_text(video_data, 'description'), 'thumbnail': xpath_text(video_data, 'poster'),
'description': strip_or_none(xpath_text(video_data, 'description')),
'duration': parse_duration(xpath_text(video_data, 'length') or xpath_text(video_data, 'trt')), 'duration': parse_duration(xpath_text(video_data, 'length') or xpath_text(video_data, 'trt')),
'timestamp': self._extract_timestamp(video_data), 'timestamp': self._extract_timestamp(video_data),
'upload_date': xpath_attr(video_data, 'metas', 'version'), 'upload_date': xpath_attr(video_data, 'metas', 'version'),
'series': xpath_text(video_data, 'showTitle'), 'series': xpath_text(video_data, 'showTitle'),
'season_number': int_or_none(xpath_text(video_data, 'seasonNumber')), 'season_number': int_or_none(xpath_text(video_data, 'seasonNumber')),
'episode_number': int_or_none(xpath_text(video_data, 'episodeNumber')), 'episode_number': int_or_none(xpath_text(video_data, 'episodeNumber')),
'is_live': is_live,
} }