]> git.bitcoin.ninja Git - youtube-dl/blobdiff - youtube_dl/extractor/lynda.py
[lynda] Check for the empty subtitle
[youtube-dl] / youtube_dl / extractor / lynda.py
index bfd9b73d250c0b90c50a5579d0e5283471e381c1..a84019bdf69b6e4588ccd6d4eff928e3a7ffdfcd 100644 (file)
@@ -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'])
@@ -156,7 +157,9 @@ class LyndaIE(InfoExtractor):
             appear_time = m_current.group('timecode')
             disappear_time = m_next.group('timecode')
             text = seq_current['Caption'].strip()
-            srt += '%s\r\n%s --> %s\r\n%s' % (str(pos), appear_time, disappear_time, text)
+            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