mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:07:58 +01:00
[extractor/common] Fix extraction of DASH formats with the same representation id (closes #15111)
This commit is contained in:
parent
84f085d4bd
commit
9d6ac71c27
2 changed files with 19 additions and 10 deletions
|
@ -493,9 +493,20 @@ def test_parse_mpd_formats(self):
|
||||||
_TEST_CASES = [
|
_TEST_CASES = [
|
||||||
(
|
(
|
||||||
# https://github.com/rg3/youtube-dl/issues/13919
|
# https://github.com/rg3/youtube-dl/issues/13919
|
||||||
|
# Also tests duplicate representation ids, see
|
||||||
|
# https://github.com/rg3/youtube-dl/issues/15111
|
||||||
'float_duration',
|
'float_duration',
|
||||||
'http://unknown/manifest.mpd',
|
'http://unknown/manifest.mpd',
|
||||||
[{
|
[{
|
||||||
|
'manifest_url': 'http://unknown/manifest.mpd',
|
||||||
|
'ext': 'm4a',
|
||||||
|
'format_id': '318597',
|
||||||
|
'format_note': 'DASH audio',
|
||||||
|
'protocol': 'http_dash_segments',
|
||||||
|
'acodec': 'mp4a.40.2',
|
||||||
|
'vcodec': 'none',
|
||||||
|
'tbr': 61.587,
|
||||||
|
}, {
|
||||||
'manifest_url': 'http://unknown/manifest.mpd',
|
'manifest_url': 'http://unknown/manifest.mpd',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'format_id': '318597',
|
'format_id': '318597',
|
||||||
|
|
|
@ -2007,16 +2007,14 @@ def add_segment_url():
|
||||||
f['url'] = initialization_url
|
f['url'] = initialization_url
|
||||||
f['fragments'].append({location_key(initialization_url): initialization_url})
|
f['fragments'].append({location_key(initialization_url): initialization_url})
|
||||||
f['fragments'].extend(representation_ms_info['fragments'])
|
f['fragments'].extend(representation_ms_info['fragments'])
|
||||||
try:
|
# According to [1, 5.3.5.2, Table 7, page 35] @id of Representation
|
||||||
existing_format = next(
|
# is not necessarily unique within a Period thus formats with
|
||||||
fo for fo in formats
|
# the same `format_id` are quite possible. There are numerous examples
|
||||||
if fo['format_id'] == representation_id)
|
# of such manifests (see https://github.com/rg3/youtube-dl/issues/15111,
|
||||||
except StopIteration:
|
# https://github.com/rg3/youtube-dl/issues/13919)
|
||||||
full_info = formats_dict.get(representation_id, {}).copy()
|
full_info = formats_dict.get(representation_id, {}).copy()
|
||||||
full_info.update(f)
|
full_info.update(f)
|
||||||
formats.append(full_info)
|
formats.append(full_info)
|
||||||
else:
|
|
||||||
existing_format.update(f)
|
|
||||||
else:
|
else:
|
||||||
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
||||||
return formats
|
return formats
|
||||||
|
|
Loading…
Reference in a new issue