aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_subtitles.py
diff options
context:
space:
mode:
authorcoletdjnz <colethedj@protonmail.com>2021-09-07 20:59:20 +0000
committerGitHub <noreply@github.com>2021-09-08 02:29:20 +0530
commita7e999beeca17909bb0088d796c3181b4f35144e (patch)
tree4328175885fc809fb7a490d4a5f812076c9f761b /test/test_subtitles.py
parent71407b3ecaf9346fe316a24d1753d365ed343ee7 (diff)
downloadhypervideo-pre-a7e999beeca17909bb0088d796c3181b4f35144e.tar.lz
hypervideo-pre-a7e999beeca17909bb0088d796c3181b4f35144e.tar.xz
hypervideo-pre-a7e999beeca17909bb0088d796c3181b4f35144e.zip
[pbs] Fix subtitle extraction (#813)
Original PR: https://github.com/ytdl-org/youtube-dl/pull/24430, https://github.com/ytdl-org/youtube-dl/pull/17434 Closes: #836, https://github.com/ytdl-org/youtube-dl/issues/18796, https://github.com/ytdl-org/youtube-dl/issues/17273 Authored-by: coletdjnz, gesa, raphaeldore
Diffstat (limited to 'test/test_subtitles.py')
-rw-r--r--test/test_subtitles.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/test_subtitles.py b/test/test_subtitles.py
index 0c5b49ee8..9b39dbd39 100644
--- a/test/test_subtitles.py
+++ b/test/test_subtitles.py
@@ -19,6 +19,7 @@ from yt_dlp.extractor import (
CeskaTelevizeIE,
LyndaIE,
NPOIE,
+ PBSIE,
ComedyCentralIE,
NRKTVIE,
RaiPlayIE,
@@ -372,5 +373,42 @@ class TestDemocracynowSubtitles(BaseTestSubtitles):
self.assertEqual(md5(subtitles['en']), 'acaca989e24a9e45a6719c9b3d60815c')
+@is_download_test
+class TestPBSSubtitles(BaseTestSubtitles):
+ url = 'https://www.pbs.org/video/how-fantasy-reflects-our-world-picecq/'
+ IE = PBSIE
+
+ def test_allsubtitles(self):
+ self.DL.params['writesubtitles'] = True
+ self.DL.params['allsubtitles'] = True
+ subtitles = self.getSubtitles()
+ self.assertEqual(set(subtitles.keys()), set(['en']))
+
+ def test_subtitles_dfxp_format(self):
+ self.DL.params['writesubtitles'] = True
+ self.DL.params['subtitlesformat'] = 'dfxp'
+ subtitles = self.getSubtitles()
+ self.assertIn(md5(subtitles['en']), ['643b034254cdc3768ff1e750b6b5873b'])
+
+ def test_subtitles_vtt_format(self):
+ self.DL.params['writesubtitles'] = True
+ self.DL.params['subtitlesformat'] = 'vtt'
+ subtitles = self.getSubtitles()
+ self.assertIn(
+ md5(subtitles['en']), ['937a05711555b165d4c55a9667017045', 'f49ea998d6824d94959c8152a368ff73'])
+
+ def test_subtitles_srt_format(self):
+ self.DL.params['writesubtitles'] = True
+ self.DL.params['subtitlesformat'] = 'srt'
+ subtitles = self.getSubtitles()
+ self.assertIn(md5(subtitles['en']), ['2082c21b43759d9bf172931b2f2ca371'])
+
+ def test_subtitles_sami_format(self):
+ self.DL.params['writesubtitles'] = True
+ self.DL.params['subtitlesformat'] = 'sami'
+ subtitles = self.getSubtitles()
+ self.assertIn(md5(subtitles['en']), ['4256b16ac7da6a6780fafd04294e85cd'])
+
+
if __name__ == '__main__':
unittest.main()