[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:
ClosedPort22 2024-06-27 21:53:15 +08:00
parent fcc727b755
commit 16ed8814be
No known key found for this signature in database
1 changed files with 13 additions and 8 deletions

View File

@ -329,13 +329,18 @@ class ABCIViewIE(InfoExtractor):
'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(
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='hls', fatal=False)
if formats:
entry_protocol='m3u8_native', m3u8_id=label, fatal=False)
if fmts:
formats.extend(fmts)
break
subtitles = {}