[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / nuevo.py
blob945fd0c9ce9012b96873c25f24be2ea8712392f7
1 from .common import InfoExtractor
2 from ..utils import float_or_none, xpath_text
5 class NuevoBaseIE(InfoExtractor):
6 def _extract_nuevo(self, config_url, video_id, headers={}):
7 config = self._download_xml(
8 config_url, video_id, transform_source=lambda s: s.strip(),
9 headers=headers)
11 title = xpath_text(config, './title', 'title', fatal=True).strip()
12 video_id = xpath_text(config, './mediaid', default=video_id)
13 thumbnail = xpath_text(config, ['./image', './thumb'])
14 duration = float_or_none(xpath_text(config, './duration'))
16 formats = []
17 for element_name, format_id in (('file', 'sd'), ('filehd', 'hd')):
18 video_url = xpath_text(config, element_name)
19 if video_url:
20 formats.append({
21 'url': video_url,
22 'format_id': format_id,
24 self._check_formats(formats, video_id)
26 return {
27 'id': video_id,
28 'title': title,
29 'thumbnail': thumbnail,
30 'duration': duration,
31 'formats': formats,