2015-12-01 23:00:47 -05:00
|
|
|
from .common import InfoExtractor
|
2024-05-26 15:27:21 -04:00
|
|
|
from ..utils import float_or_none, xpath_text
|
2015-12-01 23:00:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
class NuevoBaseIE(InfoExtractor):
|
2017-05-08 09:03:38 -04:00
|
|
|
def _extract_nuevo(self, config_url, video_id, headers={}):
|
2016-01-22 13:04:33 -05:00
|
|
|
config = self._download_xml(
|
2017-05-08 09:03:38 -04:00
|
|
|
config_url, video_id, transform_source=lambda s: s.strip(),
|
|
|
|
headers=headers)
|
2015-12-01 23:00:47 -05:00
|
|
|
|
2016-01-22 13:04:33 -05:00
|
|
|
title = xpath_text(config, './title', 'title', fatal=True).strip()
|
|
|
|
video_id = xpath_text(config, './mediaid', default=video_id)
|
2016-01-22 13:38:58 -05:00
|
|
|
thumbnail = xpath_text(config, ['./image', './thumb'])
|
2016-01-22 13:04:33 -05:00
|
|
|
duration = float_or_none(xpath_text(config, './duration'))
|
2015-12-01 23:00:47 -05:00
|
|
|
|
|
|
|
formats = []
|
|
|
|
for element_name, format_id in (('file', 'sd'), ('filehd', 'hd')):
|
2016-01-22 13:04:33 -05:00
|
|
|
video_url = xpath_text(config, element_name)
|
|
|
|
if video_url:
|
|
|
|
formats.append({
|
|
|
|
'url': video_url,
|
|
|
|
'format_id': format_id,
|
|
|
|
})
|
|
|
|
self._check_formats(formats, video_id)
|
2015-12-01 23:00:47 -05:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'duration': duration,
|
|
|
|
'formats': formats
|
|
|
|
}
|