mirror of
https://codeberg.org/polarisfm/youtube-dl.git
synced 2024-12-27 10:06:45 +00:00
[lynda] Check for the empty subtitle
This commit is contained in:
parent
3630034609
commit
7594be85ff
1 changed files with 5 additions and 2 deletions
|
@ -144,6 +144,7 @@ class LyndaIE(InfoExtractor):
|
|||
|
||||
def _fix_subtitles(self, subs):
|
||||
srt = ''
|
||||
seq_counter = 0
|
||||
for pos in range(0, len(subs) - 1):
|
||||
seq_current = subs[pos]
|
||||
m_current = re.match(self._TIMECODE_REGEX, seq_current['Timecode'])
|
||||
|
@ -155,8 +156,10 @@ class LyndaIE(InfoExtractor):
|
|||
continue
|
||||
appear_time = m_current.group('timecode')
|
||||
disappear_time = m_next.group('timecode')
|
||||
text = seq_current['Caption'].lstrip()
|
||||
srt += '%s\r\n%s --> %s\r\n%s' % (str(pos), appear_time, disappear_time, text)
|
||||
text = seq_current['Caption'].strip()
|
||||
if text:
|
||||
seq_counter += 1
|
||||
srt += '%s\r\n%s --> %s\r\n%s\r\n\r\n' % (seq_counter, appear_time, disappear_time, text)
|
||||
if srt:
|
||||
return srt
|
||||
|
||||
|
|
Loading…
Reference in a new issue