aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2024-10-26 18:02:21 +0000
committerGitHub <noreply@github.com>2024-10-26 18:02:21 +0000
commit21cdcf03a237a0c4979c941d5a5385cae44c7906 (patch)
tree6163bb40ff1873ecd8211b96b097e19e3db8835f
parent6abef74232c0fc695cd803c18ae446cacb129389 (diff)
[ie] Resolve `language` to ISO639-2 for ISM formats (#11359)
Closes #11356 Authored by: bashonly
-rw-r--r--yt_dlp/extractor/common.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 795105b7d..ecece85f5 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -47,6 +47,7 @@ from ..utils import (
FormatSorter,
GeoRestrictedError,
GeoUtils,
+ ISO639Utils,
LenientJSONDecoder,
Popen,
RegexNotFoundError,
@@ -3071,7 +3072,11 @@ class InfoExtractor:
url_pattern = stream.attrib['Url']
stream_timescale = int_or_none(stream.get('TimeScale')) or timescale
stream_name = stream.get('Name')
- stream_language = stream.get('Language', 'und')
+ # IsmFD expects ISO 639 Set 2 language codes (3-character length)
+ # See: https://github.com/yt-dlp/yt-dlp/issues/11356
+ stream_language = stream.get('Language') or 'und'
+ if len(stream_language) != 3:
+ stream_language = ISO639Utils.short2long(stream_language) or 'und'
for track in stream.findall('QualityLevel'):
KNOWN_TAGS = {'255': 'AACL', '65534': 'EC-3'}
fourcc = track.get('FourCC') or KNOWN_TAGS.get(track.get('AudioTag'))