[dvtv] Parse adaptive formats as well

The old code hit an error when it attempted to parse the string
"adaptive" for video height. Actually parsing the returned playlists is
a good idea because it adds more output formats, including some
audio-only-ones.
pull/2/head
Jan Kundrát 8 years ago committed by Sergey M․
parent 6bceb36b99
commit 765522345f
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

@ -71,6 +71,14 @@ class DVTVIE(InfoExtractor):
}, { }, {
'url': 'http://video.aktualne.cz/v-cechach-poprve-zazni-zelenkova-zrestaurovana-mse/r~45b4b00483ec11e4883b002590604f2e/', 'url': 'http://video.aktualne.cz/v-cechach-poprve-zazni-zelenkova-zrestaurovana-mse/r~45b4b00483ec11e4883b002590604f2e/',
'only_matching': True, 'only_matching': True,
}, {
'url': 'https://video.aktualne.cz/dvtv/zeman-si-jen-leci-mindraky-sobotku-nenavidi-a-babis-se-mu-te/r~960cdb3a365a11e7a83b0025900fea04/',
'md5': 'f8efe9656017da948369aa099788c8ea',
'info_dict': {
'id': '3c496fec365911e7a6500025900fea04',
'ext': 'm3u8',
'title': 'Zeman si jen léčí mindráky, Sobotku nenávidí a Babiš se mu teď hodí, tvrdí Kmenta',
}
}] }]
def _parse_video_metadata(self, js, video_id): def _parse_video_metadata(self, js, video_id):
@ -79,6 +87,7 @@ class DVTVIE(InfoExtractor):
formats = [] formats = []
for video in metadata['sources']: for video in metadata['sources']:
ext = video['type'][6:] ext = video['type'][6:]
if video['label'] != 'adaptive':
formats.append({ formats.append({
'url': video['file'], 'url': video['file'],
'ext': ext, 'ext': ext,
@ -86,6 +95,14 @@ class DVTVIE(InfoExtractor):
'height': int(video['label'].rstrip('p')), 'height': int(video['label'].rstrip('p')),
'fps': 25, 'fps': 25,
}) })
elif video['type'] == 'application/dash+xml':
formats.extend(self._extract_mpd_formats(video['file'],
video_id,
fatal=False))
elif video['type'] == 'application/vnd.apple.mpegurl':
formats.extend(self._extract_m3u8_formats(video['file'],
video_id,
fatal=False))
self._sort_formats(formats) self._sort_formats(formats)

Loading…
Cancel
Save