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