mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 07:12:41 +00:00
[rtbf] Extract all formats (closes #5947)
This commit is contained in:
parent
7ebd5376fe
commit
eb8be1fe76
1 changed files with 17 additions and 3 deletions
|
@ -21,6 +21,13 @@ class RTBFIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_QUALITIES = [
|
||||||
|
('mobile', 'mobile'),
|
||||||
|
('web', 'SD'),
|
||||||
|
('url', 'MD'),
|
||||||
|
('high', 'HD'),
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
|
@ -32,14 +39,21 @@ class RTBFIE(InfoExtractor):
|
||||||
r'data-video="([^"]+)"', webpage, 'data video')),
|
r'data-video="([^"]+)"', webpage, 'data video')),
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
video_url = data.get('downloadUrl') or data.get('url')
|
|
||||||
|
|
||||||
if data.get('provider').lower() == 'youtube':
|
if data.get('provider').lower() == 'youtube':
|
||||||
|
video_url = data.get('downloadUrl') or data.get('url')
|
||||||
return self.url_result(video_url, 'Youtube')
|
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 {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'formats': formats,
|
||||||
'title': data['title'],
|
'title': data['title'],
|
||||||
'description': data.get('description') or data.get('subtitle'),
|
'description': data.get('description') or data.get('subtitle'),
|
||||||
'thumbnail': data.get('thumbnail'),
|
'thumbnail': data.get('thumbnail'),
|
||||||
|
|
Loading…
Reference in a new issue