diff options
author | Unknown <blackjack4494@web.de> | 2020-09-02 23:33:41 +0200 |
---|---|---|
committer | Unknown <blackjack4494@web.de> | 2020-09-02 23:33:41 +0200 |
commit | 3ca3f77f9ce9dd504dc6af4ef605c245c31ff860 (patch) | |
tree | 6bd9c9352327148a78b8c46227c8d526f1447b03 /youtube_dl/extractor/nuevo.py | |
parent | 4cd6add62b54721eeb3bf76bd9c0b4d676dc4d68 (diff) |
[skip travis] adding automerge support
basically copying content of youtube_dl folder to youtube_dlc and excluding the youtube_dl folder when compiling
Diffstat (limited to 'youtube_dl/extractor/nuevo.py')
-rw-r--r-- | youtube_dl/extractor/nuevo.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/youtube_dl/extractor/nuevo.py b/youtube_dl/extractor/nuevo.py new file mode 100644 index 000000000..be1e09d37 --- /dev/null +++ b/youtube_dl/extractor/nuevo.py @@ -0,0 +1,39 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + +from ..utils import ( + float_or_none, + xpath_text +) + + +class NuevoBaseIE(InfoExtractor): + def _extract_nuevo(self, config_url, video_id, headers={}): + config = self._download_xml( + config_url, video_id, transform_source=lambda s: s.strip(), + headers=headers) + + title = xpath_text(config, './title', 'title', fatal=True).strip() + video_id = xpath_text(config, './mediaid', default=video_id) + thumbnail = xpath_text(config, ['./image', './thumb']) + duration = float_or_none(xpath_text(config, './duration')) + + formats = [] + for element_name, format_id in (('file', 'sd'), ('filehd', 'hd')): + 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) + + return { + 'id': video_id, + 'title': title, + 'thumbnail': thumbnail, + 'duration': duration, + 'formats': formats + } |