mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 02:14:32 +01:00
[CCMA] Fix multiple subtitles incompatibility
CCMA extractor used to raise an exception when attempting the download of a URL featuring multiple languages in the subtitles. When a single language is available, the field is the expected dict. When multiple languages are available, a list of dicts is provided. This commit fixes this issue.
This commit is contained in:
parent
69c4e35907
commit
8c60c29d34
@ -92,12 +92,15 @@ class CCMAIE(InfoExtractor):
|
||||
timestamp = parse_iso8601(data_iso8601)
|
||||
|
||||
subtitles = {}
|
||||
subtitols = media.get('subtitols', {})
|
||||
if subtitols:
|
||||
sub_url = subtitols.get('url')
|
||||
subtitols = media.get('subtitols', [])
|
||||
# Single language -> dict; multiple languages -> List[dict]
|
||||
if isinstance(subtitols, dict):
|
||||
subtitols = [subtitols]
|
||||
for st in subtitols:
|
||||
sub_url = st.get('url')
|
||||
if sub_url:
|
||||
subtitles.setdefault(
|
||||
subtitols.get('iso') or subtitols.get('text') or 'ca', []).append({
|
||||
st.get('iso') or 'ca', []).append({
|
||||
'url': sub_url,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user