mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 17:22:31 +01:00
[extractor/common] Add default subtitles lang
This commit is contained in:
parent
51047444aa
commit
ce00af8767
@ -1135,7 +1135,7 @@ def _parse_smil_formats(self, smil, smil_url, video_id, namespace=None, f4m_para
|
|||||||
|
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _parse_smil_subtitles(self, smil, namespace=None):
|
def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'):
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for num, textstream in enumerate(smil.findall(self._xpath_ns('.//textstream', namespace))):
|
for num, textstream in enumerate(smil.findall(self._xpath_ns('.//textstream', namespace))):
|
||||||
src = textstream.get('src')
|
src = textstream.get('src')
|
||||||
@ -1146,7 +1146,7 @@ def _parse_smil_subtitles(self, smil, namespace=None):
|
|||||||
type_ = textstream.get('type')
|
type_ = textstream.get('type')
|
||||||
if type_ == 'text/srt':
|
if type_ == 'text/srt':
|
||||||
ext = 'srt'
|
ext = 'srt'
|
||||||
lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName')
|
lang = textstream.get('systemLanguage') or textstream.get('systemLanguageName') or subtitles_lang
|
||||||
subtitles.setdefault(lang, []).append({
|
subtitles.setdefault(lang, []).append({
|
||||||
'url': src,
|
'url': src,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
|
Loading…
Reference in New Issue
Block a user