fixed bug where nontranslatable transcripts would throw an exception

This commit is contained in:
Jonas Depoix 2019-12-30 14:38:27 +01:00
parent f1e4754ca4
commit 8287d1088e
1 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class TranscriptList():
caption['name']['simpleText'],
caption['languageCode'],
caption.get('kind', '') == 'asr',
translation_languages if caption['isTranslatable'] else []
translation_languages if caption.get('isTranslatable', False) else []
)
return TranscriptList(
@ -295,7 +295,7 @@ class _TranscriptParser():
{
'text': re.sub(self.HTML_TAG_REGEX, '', unescape(xml_element.text)),
'start': float(xml_element.attrib['start']),
'duration': float(xml_element.attrib['dur']),
'duration': float(xml_element.attrib.get('dur', '0.0')),
}
for xml_element in ElementTree.fromstring(plain_data)
if xml_element.text is not None