mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 10:24:33 +01:00
Handle subtitles properly
The subtitles are parsed from each mediaselector playlist in the form of a dict keyed by language each of whose values is a list containing a dict keyed by url and sttl type. There seems to be no attempt in the extractor to make this list contain more than one dict. So a strategy is needed to deal with multiple sttl types for the same language. For backward compatibility, let the first of any duplicate sttl languages take precedence.
This commit is contained in:
parent
94f4d75bf6
commit
9b74c4b7db
@ -359,12 +359,17 @@ class BBCCoUkIE(InfoExtractor):
|
|||||||
try:
|
try:
|
||||||
formatsAndSubtitles = self._download_media_selector_url(
|
formatsAndSubtitles = self._download_media_selector_url(
|
||||||
mediaselector_url % programme_id, programme_id)
|
mediaselector_url % programme_id, programme_id)
|
||||||
# formats should always be set, but just in case
|
# formats (a list) should always be set, but just in case
|
||||||
if formatsAndSubtitles[0]:
|
if formatsAndSubtitles[0]:
|
||||||
formats += formatsAndSubtitles[0]
|
formats += formatsAndSubtitles[0]
|
||||||
# subtitles may never be set
|
# subtitles subtitles (a dict {(lang,sttl)})
|
||||||
if formatsAndSubtitles[1]:
|
if formatsAndSubtitles[1]:
|
||||||
subtitles += formatsAndSubtitles[1]
|
if not subtitles:
|
||||||
|
subtitles = formatsAndSubtitles[1]
|
||||||
|
else:
|
||||||
|
# prioritise the first sttl for each lang
|
||||||
|
formatsAndSubtitles[1].update(subtitles)
|
||||||
|
subtitles = formatsAndSubtitles[1]
|
||||||
except BBCCoUkIE.MediaSelectionError as e:
|
except BBCCoUkIE.MediaSelectionError as e:
|
||||||
if e.id in ('notukerror', 'geolocation', 'selectionunavailable'):
|
if e.id in ('notukerror', 'geolocation', 'selectionunavailable'):
|
||||||
last_exception = e
|
last_exception = e
|
||||||
|
Loading…
Reference in New Issue
Block a user