Added support for additional vtt subtitle format (WebVTT) in youtube-dl.
authorIsmael Mejia <iemejia@gmail.com>
Wed, 26 Jun 2013 09:28:47 +0000 (11:28 +0200)
committerIsmael Mejia <iemejia@gmail.com>
Wed, 26 Jun 2013 09:28:47 +0000 (11:28 +0200)
README.md
test/test_youtube_subtitles.py
youtube_dl/YoutubeDL.py
youtube_dl/__init__.py

index 7d190249df4e36b95f476bfaef26e86cb397e922..e43332724fc89d30e90cf31149486a15c6d1639e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -121,7 +121,7 @@ which means you can modify it, redistribute it or use it however you like.
                                video (currently youtube only)
     --list-subs                lists all available subtitles for the video
                                (currently youtube only)
-    --sub-format FORMAT        subtitle format [srt/sbv] (default=srt)
+    --sub-format FORMAT        subtitle format [srt/sbv/vtt] (default=srt)
                                (currently youtube only)
     --sub-lang LANG            language of the subtitles to download (optional)
                                use IETF language tags like 'en'
index dad15de374bbfe3564452fe4b1b5f307e89bc0d8..5814e13d48cb2781eed1f6f766dc29bb03f6c6a7 100644 (file)
@@ -84,7 +84,7 @@ class TestYoutubeSubtitles(unittest.TestCase):
         info_dict = IE.extract('QRS8MkLhQmM')
         subtitles = info_dict[0]['subtitles']
         self.assertEqual(len(subtitles), 13)
-    def test_youtube_subtitles_format(self):
+    def test_youtube_subtitles_sbv_format(self):
         DL = FakeYDL()
         DL.params['writesubtitles'] = True
         DL.params['subtitlesformat'] = 'sbv'
@@ -92,6 +92,14 @@ class TestYoutubeSubtitles(unittest.TestCase):
         info_dict = IE.extract('QRS8MkLhQmM')
         sub = info_dict[0]['subtitles'][0]
         self.assertEqual(md5(sub[2]), '13aeaa0c245a8bed9a451cb643e3ad8b')
+    def test_youtube_subtitles_vtt_format(self):
+        DL = FakeYDL()
+        DL.params['writesubtitles'] = True
+        DL.params['subtitlesformat'] = 'vtt'
+        IE = YoutubeIE(DL)
+        info_dict = IE.extract('QRS8MkLhQmM')
+        sub = info_dict[0]['subtitles'][0]
+        self.assertEqual(md5(sub[2]), '356cdc577fde0c6783b9b822e7206ff7')
     def test_youtube_list_subtitles(self):
         DL = FakeYDL()
         DL.params['listsubtitles'] = True
index e9a24a95aaaa0823e2ca8c437bcf3c865a152533..4abcbbeaca570cd766c3d24815a3992e576ab240 100644 (file)
@@ -75,7 +75,7 @@ class YoutubeDL(object):
     writeautomaticsub: Write the automatic subtitles to a file
     allsubtitles:      Downloads all the subtitles of the video
     listsubtitles:     Lists all available subtitles for the video
-    subtitlesformat:   Subtitle format [sbv/srt] (default=srt)
+    subtitlesformat:   Subtitle format [srt/sbt/vtt] (default=srt)
     subtitleslang:     Language of the subtitles to download
     keepvideo:         Keep the video file after post-processing
     daterange:         A DateRange object, download only if the upload_date is in the range.
index 42abb8358f52e416b1e51cf082226091f211c0c2..6a8fc5e96036bfec41414022055c8e4663eb4097 100644 (file)
@@ -205,7 +205,7 @@ def parseOpts(overrideArguments=None):
             help='lists all available subtitles for the video (currently youtube only)', default=False)
     video_format.add_option('--sub-format',
             action='store', dest='subtitlesformat', metavar='FORMAT',
-            help='subtitle format [srt/sbv] (default=srt) (currently youtube only)', default='srt')
+            help='subtitle format [srt/sbv/vtt] (default=srt) (currently youtube only)', default='srt')
     video_format.add_option('--sub-lang', '--srt-lang',
             action='store', dest='subtitleslang', metavar='LANG',
             help='language of the subtitles to download (optional) use IETF language tags like \'en\'')