diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-06-10 14:12:43 +0200 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2015-06-10 14:12:43 +0200 |
commit | eb8be1fe76a9fbc285e6c957b3fdd5c05135ae3f (patch) | |
tree | 501f661e5049b5e1d4cda803be02b561c3f0e937 | |
parent | 7ebd5376feb493edd0bc04abd07bba89397b7307 (diff) |
[rtbf] Extract all formats (closes #5947)
-rw-r--r-- | youtube_dl/extractor/rtbf.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/youtube_dl/extractor/rtbf.py b/youtube_dl/extractor/rtbf.py index 5a381d9ce..e4215d546 100644 --- a/youtube_dl/extractor/rtbf.py +++ b/youtube_dl/extractor/rtbf.py @@ -21,6 +21,13 @@ class RTBFIE(InfoExtractor): } } + _QUALITIES = [ + ('mobile', 'mobile'), + ('web', 'SD'), + ('url', 'MD'), + ('high', 'HD'), + ] + def _real_extract(self, url): video_id = self._match_id(url) @@ -32,14 +39,21 @@ class RTBFIE(InfoExtractor): r'data-video="([^"]+)"', webpage, 'data video')), video_id) - video_url = data.get('downloadUrl') or data.get('url') - if data.get('provider').lower() == 'youtube': + video_url = data.get('downloadUrl') or data.get('url') return self.url_result(video_url, 'Youtube') + formats = [] + for key, format_id in self._QUALITIES: + format_url = data['sources'].get(key) + if format_url: + formats.append({ + 'format_id': format_id, + 'url': format_url, + }) return { 'id': video_id, - 'url': video_url, + 'formats': formats, 'title': data['title'], 'description': data.get('description') or data.get('subtitle'), 'thumbnail': data.get('thumbnail'), |