]>
Commit | Line | Data |
---|---|---|
dcdb292f | 1 | # coding: utf-8 |
d570746e AAA |
2 | from __future__ import unicode_literals |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | from ..utils import ( | |
7 | float_or_none, | |
8 | xpath_text | |
9 | ) | |
10 | ||
11 | ||
12 | class NuevoBaseIE(InfoExtractor): | |
3d40084b | 13 | def _extract_nuevo(self, config_url, video_id, headers={}): |
10677ece | 14 | config = self._download_xml( |
3d40084b S |
15 | config_url, video_id, transform_source=lambda s: s.strip(), |
16 | headers=headers) | |
d570746e | 17 | |
10677ece S |
18 | title = xpath_text(config, './title', 'title', fatal=True).strip() |
19 | video_id = xpath_text(config, './mediaid', default=video_id) | |
ea178204 | 20 | thumbnail = xpath_text(config, ['./image', './thumb']) |
10677ece | 21 | duration = float_or_none(xpath_text(config, './duration')) |
d570746e AAA |
22 | |
23 | formats = [] | |
24 | for element_name, format_id in (('file', 'sd'), ('filehd', 'hd')): | |
10677ece S |
25 | video_url = xpath_text(config, element_name) |
26 | if video_url: | |
27 | formats.append({ | |
28 | 'url': video_url, | |
29 | 'format_id': format_id, | |
30 | }) | |
31 | self._check_formats(formats, video_id) | |
d570746e AAA |
32 | |
33 | return { | |
34 | 'id': video_id, | |
35 | 'title': title, | |
36 | 'thumbnail': thumbnail, | |
37 | 'duration': duration, | |
38 | 'formats': formats | |
39 | } |