mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-10 08:42:13 +08:00
[televizeseznam] extract all formats
This commit is contained in:
parent
792458fa26
commit
03b8e09319
@ -49,19 +49,29 @@ class TelevizeSeznamIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
return subtitles
|
return subtitles
|
||||||
|
|
||||||
def extract_formats(self, spl_url, play_list):
|
def _extract(self, ext, spl_url, play_list):
|
||||||
formats = []
|
formats = []
|
||||||
for r, v in play_list.items():
|
for r, v in play_list.items():
|
||||||
format = {
|
format = {
|
||||||
'format_id': r,
|
'format_id': r,
|
||||||
'url': urljoin(spl_url, v.get('url')),
|
'url': urljoin(spl_url, v.get('url')),
|
||||||
'protocol': 'https',
|
'protocol': 'https',
|
||||||
'ext': 'mp4',
|
'ext': ext
|
||||||
}
|
}
|
||||||
if v.get('resolution'):
|
if v.get('resolution'):
|
||||||
format.update({ 'width': v['resolution'][0], 'height': v['resolution'][1] })
|
format.update({ 'width': v['resolution'][0], 'height': v['resolution'][1] })
|
||||||
|
|
||||||
formats.append(format)
|
formats.append(format)
|
||||||
|
return formats
|
||||||
|
|
||||||
|
def extract_formats(self, spl_url, play_list):
|
||||||
|
formats = []
|
||||||
|
|
||||||
|
if play_list.get('http_stream') and play_list['http_stream'].get('qualities'):
|
||||||
|
formats.extend(self._extract(None, spl_url, play_list['http_stream']['qualities']))
|
||||||
|
|
||||||
|
if play_list.get('mp4'):
|
||||||
|
formats.extend(self._extract('mp4', spl_url, play_list['mp4']))
|
||||||
|
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
@ -84,7 +94,6 @@ class TelevizeSeznamIE(InfoExtractor):
|
|||||||
spl_url = metadata['Location']
|
spl_url = metadata['Location']
|
||||||
metadata = self._download_json(spl_url, video_id, 'Redirected -> Downloading playlist')
|
metadata = self._download_json(spl_url, video_id, 'Redirected -> Downloading playlist')
|
||||||
play_list = metadata['data']
|
play_list = metadata['data']
|
||||||
formats = self.extract_formats(spl_url, play_list['mp4'])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
@ -92,5 +101,5 @@ class TelevizeSeznamIE(InfoExtractor):
|
|||||||
'title': data['episode'].get('name'),
|
'title': data['episode'].get('name'),
|
||||||
'description': data['episode'].get('perex'),
|
'description': data['episode'].get('perex'),
|
||||||
'subtitles': self.extract_subtitles(spl_url, play_list.get('subtitles')),
|
'subtitles': self.extract_subtitles(spl_url, play_list.get('subtitles')),
|
||||||
'formats': formats
|
'formats': self.extract_formats(spl_url, play_list)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user