mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
[abc:iview] extract from both 'hls' and 'hls-latest'
This ensures backward compatibility by also providing the pre-merged formats
This commit is contained in:
parent
fcc727b755
commit
16ed8814be
|
@ -329,14 +329,19 @@ def tokenize_url(url, token):
|
|||
'hdnea': token,
|
||||
})
|
||||
|
||||
for sd_url in traverse_obj(stream, ('streams', 'hls-latest', ('1080', '720', 'sd', 'sd-low'), {str})):
|
||||
if not sd_url:
|
||||
continue
|
||||
formats = self._extract_m3u8_formats(
|
||||
tokenize_url(sd_url, token), video_id, 'mp4',
|
||||
entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
|
||||
if formats:
|
||||
break
|
||||
formats = []
|
||||
# hls: pre-merged formats
|
||||
# hls-latest: same as hls, but sometimes has separate audio tracks
|
||||
# Note: pre-merged formats in hls-latest are treated as video-only if audio-only tracks
|
||||
# are present, so we extract both types
|
||||
for label in ('hls', 'hls-latest'):
|
||||
for sd_url in traverse_obj(stream, ('streams', label, ('1080', '720', 'sd', 'sd-low'), {str})):
|
||||
fmts = self._extract_m3u8_formats(
|
||||
tokenize_url(sd_url, token), video_id, 'mp4',
|
||||
entry_protocol='m3u8_native', m3u8_id=label, fatal=False)
|
||||
if fmts:
|
||||
formats.extend(fmts)
|
||||
break
|
||||
|
||||
subtitles = {}
|
||||
src_vtt = traverse_obj(stream, ('captions', 'src-vtt'))
|
||||
|
|
Loading…
Reference in New Issue
Block a user