about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M. <dstftw@gmail.com>2015-03-02 21:15:26 +0600
committerSergey M. <dstftw@gmail.com>2015-03-02 21:15:26 +0600
commit549e58069cf826b81b3aace3682ecff767b95cd4 (patch)
treeb7ec8f105f91ba63a0d84fbe3e309080b02c1a4a
parent36300346092937a8320fa4ae7303bc1b746a69ab (diff)
parent7594be85ffebee0c1ba457855ee7f4917e96499b (diff)
downloadyoutube-dl-549e58069cf826b81b3aace3682ecff767b95cd4.tar.gz
youtube-dl-549e58069cf826b81b3aace3682ecff767b95cd4.tar.xz
youtube-dl-549e58069cf826b81b3aace3682ecff767b95cd4.zip
Merge pull request #5105 from Ftornik/Lynda-subtitle-hotfix-2
[lynda] Check for the empty subtitles
-rw-r--r--youtube_dl/extractor/lynda.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/extractor/lynda.py b/youtube_dl/extractor/lynda.py
index 5dc22da22..a84019bdf 100644
--- a/youtube_dl/extractor/lynda.py
+++ b/youtube_dl/extractor/lynda.py
@@ -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